|
 |
Dan Johnson wrote:
>
> I was trying to figure out how to warp a cylinder into a sphere sweep
> helix, but it didn't work. It squished the thing for some reason. My
> thought was to turn the x dimension of the cylinder into the radius, and
> the y dimension into the angle, but everything needs to be done
> backwards. I was trying to use a rectangular to polar conversion
> formula, because of things needing to be backwards.
>
> I would appreciate it if someone could tell how to do it right. I would
> also like to know how to do the same thing using parametic surfaces, and
> what it was that I was doing wrong.
>
> I think this is the code I was using.
>
> #include "colors.inc"
> #include "finish.inc"
> light_source {<3,4,-5>*100 rgb 2}
> camera {location <12,0,-14> look_at 0 }
>
> #version unofficial MegaPov 0.7;
>
> #declare Cyl= function{((x-3)^2+y^2)^.5 -1}
> //plane{y,-2 pigment{White}}
> #declare Cyl2 = function {Cyl(x,z*cos(pi/3) - y*sin(pi/3),
> y*cos(pi/3) + z*sin(pi/3))}
> #declare Cir = function{(x*cos(y)+x*sin(y))}
> #declare Cir2 = function{Cyl2(sqr(x^2+y^2),atan2(x,y),z)}
I just had a very brief look at your code,
and right now I don't know if what you are
doing here are the right way to go.
(I'm not even sure if I understand what
shape you are trying make. Maybe I can
look at it tomorrow.)
BUT if you are doing conversion from
rectangular to polar coordinates, then
this expression looks suspicious:
> #declare Cir2 = function{Cyl2(sqr(x^2+y^2),atan2(x,y),z)}
Shouldn't sqr(x^2+y^2) be sqrt(x^2 + y^2) ?
And this function:
> #declare Cir = function{(x*cos(y)+x*sin(y))}
is equivalent to this function:
#declare Cir = function { x*(cos(y) + sin(y)) }
Was that your intention ?
Tor Olav
Post a reply to this message
|
 |