THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/03/2003 at 09:57, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform: Windows ;
Language(s) : C++ ;
---------
Hello again,
C4D uses a rotational system based upon HPB. For lights pointed at the origin, the only values of real interest are Heading and Pitch, Bank just spins the light about its own Z-axis. So, for simplicity, these rotations have become Spherical Coordinates (R, theta, phi) where R isn't of much concern or Elevation and Azimuth angles off of the XZ plane.
The incoming values are Euler angles (rotations about the fixed world axes). Order seems to be set, which explains some of the strange results in Poser when the (Infinite) light is, for instance, rotated in the Y-axis after having been rotated in the other axes. Since no information is given, I must assume that the order in the Poser file (XYZ) is the order in which the rotations are applied.
So, my question is this: How do I convert fixed XYZ axis rotations into HP spherical angles? I'll keep thumbing through my books, but haven't hit upon anything yet. One possible solution (sarcasm) is to calculate the XYZ point on a unit sphere and use that point to solve for spherical coordinates (P(x,y,z) = R*sin(theta)*cos(phi), R*sin(theta)*sin(phi), R*cos(theta)), but as is easily seen, there are two solutions for x and y. It has been some time since this kind of problem has arisen in my programming efforts - code of mine which might have helped has long since been lost to the great bit-bucket in the sky.
Thanks for any mathematical or algorithmic links or information,
Robert