|
|
RTFM
The short version is this.
"#declare Cx" means create a variable
"#while" means start a conditional loop
"box" means make a box at the location set up by the math
"#declare Cx = CX + Step" increments the variable
"#end" sends it back to the #while until the condition is fulfilled
Everything else is gravy.
"Arie L. Stavchansky" <nat### [at] hotmailcom> wrote in message
news:B7E8EF8C.BAD%nat### [at] hotmailcom...
> Hi there,
>
> I know it is alot to ask, but can you please explain this code and
algorithm
> in English? I don't have a very strong math background and would like to
> understand how it is done. This is amazing stuff!
>
> in article 3BB8FCF6.CF0A4C7F@hotmail.com, Tor Olav Kristensen at
> tor### [at] hotmailcom wrote on 10/1/01 7.32 PM:
>
> >
> > Lovely shape !
> >
> > Here's a way to make a sphere with your boxes:
> >
> > #version 3.1;
> >
> > #include "colors.inc"
> > #include "golds.inc"
> >
> > #declare Cx = -pi;
> > #declare Step = pi/30;
> > #while(Cx < pi)
> > #declare Cy = -pi;
> > #while(Cy < pi)
> > box {
> > -<1, 1, 1>, <1, 1, 1>
> > scale 0.04
> > translate -y
> > rotate <degrees(Cx), degrees(Cy), 0>
> > texture { T_Gold_3C }
> > }
> > #declare Cy = Cy + Step;
> > #end // while
> > #declare Cx = Cx + Step;
> > #end // while
> >
> > light_source { <-2, 1, -2> color White }
> >
> > background { color Blue/2 }
> >
> > camera {
> > location -3*z
> > look_at <0, 0, 0>
> > }
> >
> >
> > Tor Olav
> >
> >
> > Zebu wrote:
> >>
> >> Content-Transfer-Encoding: 8Bit
> >>
> >> Found an interesting shape while trying to make a sphere...
> >>
> >> If there's a math guru out there who knows how to translate this code
to
> >>
> >> make a sphere, don't hesitate :-)
> >>
> >> #declare Cx=-pi;
> >>
> >> #declare Step=pi/30;
> >>
> >> #while(Cx<pi)
> >>
> >> #declare Cy=-pi;
> >>
> >> #while(Cy<pi)
> >>
> >> box {<-.04,-.04,-.04>,<.04,.04,.04>
> >>
> >> texture { T_Gold_3C }
> >>
> >> rotate <degrees(Cx),degrees(Cy),00>
> >>
> >> translate <sin(Cx),cos(Cx)*(abs(Step-Cy))/2,sin(Cy)> }
> >>
> >> #declare Cy=Cy+Step;
> >>
> >> #end
> >>
> >> #declare Cx=Cx+Step;
> >>
> >> #end
>
Post a reply to this message
|
|