Orientation and Math with respect to Java 3D
Java 3D's default view is confusing in relation to mathematical formulas. The following discussion is from the viewpoint of an avatar walking on the X-Z plane.
By math formulas the definition of how an angle should increase is to increase from one positive axis to another positive axis (+X to + Y or +Z to +X). Staying with this definition and drawing the axis as Java 3D does then angles increase in a clockwise manner. Sun's documentation states that rotations are "counter-clockwise about an axis". We use "rotY()" to turn the viewpoint of an avatar. So if we draw with compass directions (looking down on our world such that the +Y axis is actually coming out of this image toward you):
Now if we use the rotY() method and turn +30 degrees we are looking into Quadrant 1. This is sticking with the "right hand rule" which states that "stick your thumb in the direction of positive along an axis and the direction of the curl of your fingers is the direction of angle rotation". Thus "turning left" (from the point of view of a avatar standing on the ground) is an increase of the angle!
Hence the formula:
sin(angle) = a/c; // where a = x position and c = distance from viewer
or rewritten to calculate an x position:
a = c*sin(angle);
If we plug in arbitrary test values of angle = 30, distance = 10; yields an incorrect result of +5!!! Damn, math doesn't work! And the reason is that an angle of ZERO should not be looking down the -Z axis it should be looking down the +Z axis. So we must flip everything by 180 degrees which is accomplished by:
a = -c*sin(angle);
In other words an angle of zero is looking out the BACK of your head!!! Hence to make this looking out forward we must flip everything mathematically.