Fix javadoc for Quaternion.toAngles() method (#802)

* Fix javadoc for Quaternion toAngles and fromAngles

JME treats Z as the main direction or look direction so x is pitch, y is yaw, and z is roll,
empirephoenix-patch-1
Ali-RS 7 years ago committed by Rémy Bouquet
parent c4b635bb6f
commit 75aa147eec
  1. 14
      jme3-core/src/main/java/com/jme3/math/Quaternion.java

@ -217,7 +217,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
/**
* <code>fromAngles</code> builds a quaternion from the Euler rotation
* angles (y,r,p).
* angles (x,y,z) aka (pitch, yaw, roll).
*
* @param angles
* the Euler angles of rotation (in radians).
@ -233,7 +233,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
/**
* <code>fromAngles</code> builds a Quaternion from the Euler rotation
* angles (x,y,z) aka (pitch, yaw, rall)). Note that we are applying in order: (y, z, x) aka (yaw, roll, pitch) but
* angles (x,y,z) aka (pitch, yaw, roll)). Note that we are applying in order: (y, z, x) aka (yaw, roll, pitch) but
* we've ordered them in x, y, and z for convenience.
* @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm">http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm</a>
*
@ -276,8 +276,8 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
}
/**
* <code>toAngles</code> returns this quaternion converted to Euler
* rotation angles (yaw,roll,pitch).<br/>
* <code>toAngles</code> returns this quaternion converted to Euler rotation
* angles (x,y,z) aka (pitch, yaw, roll).<br/>
* Note that the result is not always 100% accurate due to the implications of euler angles.
* @see <a href="http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm">http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm</a>
*
@ -309,9 +309,9 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
angles[2] = -FastMath.HALF_PI;
angles[0] = 0;
} else {
angles[1] = FastMath.atan2(2 * y * w - 2 * x * z, sqx - sqy - sqz + sqw); // roll or heading
angles[2] = FastMath.asin(2 * test / unit); // pitch or attitude
angles[0] = FastMath.atan2(2 * x * w - 2 * y * z, -sqx + sqy - sqz + sqw); // yaw or bank
angles[1] = FastMath.atan2(2 * y * w - 2 * x * z, sqx - sqy - sqz + sqw); // yaw or heading
angles[2] = FastMath.asin(2 * test / unit); // roll or bank
angles[0] = FastMath.atan2(2 * x * w - 2 * y * z, -sqx + sqy - sqz + sqw); // pitch or attitude
}
return angles;
}

Loading…
Cancel
Save