POV-Ray : Newsgroups : povray.general : Radial coordinates in POV Server Time
5 Nov 2024 11:17:16 EST (-0500)
  Radial coordinates in POV (Message 1 to 8 of 8)  
From: Ed Jackson
Subject: Radial coordinates in POV
Date: 18 May 2003 01:57:51
Message: <pan.2003.05.18.05.57.47.250837.2858@iastate.edu>
Hi all,

I was just messing around with media densities using various probability
densities for the electron in a hydrogen atom.  These things are usually
done in radial coordinates because the math is simpler.

The conversion from cartesian to radial coordiates is simple enough, and
functions.inc even includes f_r, f_th, and f_ph to help--which leads me to
my question.

From my experience in physics, it is conventional to define theta as the
angle from the vertical axis (latitude, ranging from zero at the north
pole to pi at the south pole), and phi as the longitudinal angle (ranging
from zero to 2*pi).

POV, it seems, defines these in the opposite manner.  I was hoping that
someone in the know could tell me whether this is a mistake, or if the
convention is simply less well-defined than I believed.  After all, we
usually use z-up cartesian coordinates in physics, too.  :)

Anyway, I'm just curious...if it really bothered me, I'd just define my
own conversion functions.

	Thanks,
	 Ed


Post a reply to this message

From: Marc Jacquier
Subject: Re: Radial coordinates in POV
Date: 18 May 2003 04:23:41
Message: <3ec7430d$1@news.povray.org>

pan### [at] iastateedu...
> Hi all,
>
> POV, it seems, defines these in the opposite manner.  I was hoping that
> someone in the know could tell me whether this is a mistake, or if the
> convention is simply less well-defined than I believed.  After all, we
> usually use z-up cartesian coordinates in physics, too.  :)

But pov  uses a left hand coordinate system: x-right, y-up, z -ahead
>
Marc


Post a reply to this message

From: Marc Jacquier
Subject: Re: Radial coordinates in POV
Date: 18 May 2003 04:28:00
Message: <3ec74410$1@news.povray.org>
Well to be complete you can set direct right hand coordinate system with
 sky     z
  up      z
in your camera definition
Then build your scene in a right hand system

Marc


3ec7430d$1@news.povray.org...
>
> But pov  uses a left hand coordinate system: x-right, y-up, z -ahead
> >
> Marc
>
>


Post a reply to this message

From: Christoph Hormann
Subject: Re: Radial coordinates in POV
Date: 18 May 2003 04:49:52
Message: <3EC7492F.89CD9681@gmx.de>
Ed Jackson wrote:
> 
> [...]
> 
> POV, it seems, defines these in the opposite manner.  I was hoping that
> someone in the know could tell me whether this is a mistake, or if the
> convention is simply less well-defined than I believed.  After all, we
> usually use z-up cartesian coordinates in physics, too.  :)

As you correctly describe there is no conversion function from cartesian
to spherical coordinates in POV-Ray, you have to create your own (and can
use the mentioned built-in functions for that).  Depending on how you use
them you get different types of coordinate systems.  The formulas of the
f_r, f_th and f_ph function can be found in the docs so it should not be a
problem to create whatever function is needed with them.

When you don't get what you are trying to achieve you probably messed with
the axes or the value ranges of the functions.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: JC (Exether)
Subject: Re: Radial coordinates in POV
Date: 19 May 2003 05:55:04
Message: <3EC8AAC3.8090502@club-internet.fr>
If I get it right, it seems to me that the base of the problem is that 
POVRay uses indirect coordinate system (left hand), but it is not enough 
to take z as the up direction, you should take -z. In a direct 
coordinate system (u, v, w), the w vector should see u->v in the 
trigonometric way (which is counter clock). Putting "-" in the right 
places in your formulas should do it.

JC

Ed Jackson wrote:
> Hi all,
> 
> I was just messing around with media densities using various probability
> densities for the electron in a hydrogen atom.  These things are usually
> done in radial coordinates because the math is simpler.
> 
> The conversion from cartesian to radial coordiates is simple enough, and
> functions.inc even includes f_r, f_th, and f_ph to help--which leads me to
> my question.
> 
> From my experience in physics, it is conventional to define theta as the
> angle from the vertical axis (latitude, ranging from zero at the north
> pole to pi at the south pole), and phi as the longitudinal angle (ranging
> from zero to 2*pi).
> 
> POV, it seems, defines these in the opposite manner.  I was hoping that
> someone in the know could tell me whether this is a mistake, or if the
> convention is simply less well-defined than I believed.  After all, we
> usually use z-up cartesian coordinates in physics, too.  :)
> 
> Anyway, I'm just curious...if it really bothered me, I'd just define my
> own conversion functions.
> 
> 	Thanks,
> 	 Ed


Post a reply to this message

From: Retsam
Subject: Re: Radial coordinates in POV
Date: 21 May 2003 14:00:07
Message: <web.3ecbbdea2d7241252a3ff2e70@news.povray.org>
JC (Exether) wrote:
>If I get it right, it seems to me that the base of the problem is that
>POVRay uses indirect coordinate system (left hand), but it is not enough
>to take z as the up direction, you should take -z. In a direct
>coordinate system (u, v, w), the w vector should see u->v in the
>trigonometric way (which is counter clock). Putting "-" in the right
>places in your formulas should do it.
>
>JC
>

Actually, you want up to be +z, to be consistent with physics.  Depending on
whether you do x or y as the "right" axis, you would have the following:

up z, right x, direction y
or
up z, right y, direction -x

The latter of the two is nice in that it is just a basic rotation (i.e.
quandrant I is in the same location) of the right-handed POV-Ray system: up
y, right x, dir -z.  Just replace x with y, y with z, and z with x.


Post a reply to this message

From: Ed Jackson
Subject: Re: Radial coordinates in POV
Date: 21 May 2003 18:29:10
Message: <pan.2003.05.21.22.29.02.41267.16589@iastate.edu>
On Sun, 18 May 2003 03:24:54 -0500, Marc Jacquier wrote:


> But pov  uses a left hand coordinate system: x-right, y-up, z -ahead
>
>

You're right, of course (as are other replies to my post, thanks!), but
the radial coordinates should be independent of the cartesian ones. That
is, theta is defined as the angle from the positive vertical axis whether
you name that axis "y" or "z" or "Jean-Pierre".

However, it is the function f_ph which returns this value.  I was just
curious why it was defined that way, and thought that perhaps the
definitions of phi and theta were not exactly universal--much like the
question of y-up v. z-up or right-handed v. left-handed  cartesian coordinate
systems.  (Again, I could call it "phi" or "theta" or "Franz" and it
woudld be the same thing...)

Anyway, it's not really important so long as you know what's coming out of
the functions.  Thanks, everyone, for your replies.

	-Ed


Post a reply to this message

From: Christopher James Huff
Subject: Re: Radial coordinates in POV
Date: 21 May 2003 19:09:13
Message: <cjameshuff-6E6E7A.18100621052003@netplex.aussie.org>
In article <pan### [at] iastateedu>,
 Ed Jackson <eja### [at] iastateedu> wrote:

> However, it is the function f_ph which returns this value.  I was just
> curious why it was defined that way, and thought that perhaps the
> definitions of phi and theta were not exactly universal--

There are several conventions in use. Mathematics usually uses a 
different convention (theta = rotation or longitude, phi = elevation or 
latitude) than physics or engineering, which swaps the meanings. 
Sometimes they are even completely reversed, like < r, theta, phi> or 
<r, phi, theta>. You just have to watch out for what system is being 
used.

http://mathworld.wolfram.com/SphericalCoordinates.html


> much like the question of y-up v. z-up or right-handed v. left-handed 
> cartesian coordinate systems.

The former, but not the latter. Right handed and left handed systems are 
both well defined mathematically, it's their usage (like which dimension 
is "up") that is disputed. For example, in the case of computer 2D 
graphics, you already use "y" for height and "x" for side to side, so 
"z" for depth is the simplest way to extend things to 3D.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.