|
![](/i/fill.gif) |
Chris Huff wrote:
>
> Just use functions to convert the cartesian coordinates to spherical
> coordinates. There are many examples of these functions out there, just
> guessing I would write:
> #declare R = function {sqrt(sqr(x) + sqr(y) + sqr(z))}
> #declare Phi = function {atan2(x, z)}
> #declare Theta = function {atan2(y, sqrt(sqr(x) + sqr(z)))}
>
> I might have Phi an Theta backwards or going the wrong direction(or
> completely wrong, since I am going from memory), but this gives the
> general idea. Just feed these functions the xyz cartesian coordinates
> and use the result as the spherical coordinates.
>
You made way to much thoughts about it :-)
There are already predefined functions in megapov:
"R" = sqrt(x*x+y*y+z*z)
"TH" = atan2(x,z)
"PH" = atan2(sqrt(x*x + z*z ),y)
Anyway my respect for you doing it from memory.
Christoph
--
Christoph Hormann <chr### [at] gmx de>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |