From e87eeb20a558a314ee5aeaf9c4b96c2e708d2ae4 Mon Sep 17 00:00:00 2001 From: Ali-RS Date: Sun, 14 Jan 2018 19:48:26 +0330 Subject: [PATCH] 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, --- .../src/main/java/com/jme3/math/Quaternion.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/math/Quaternion.java b/jme3-core/src/main/java/com/jme3/math/Quaternion.java index 1ee1305d2..30970b996 100644 --- a/jme3-core/src/main/java/com/jme3/math/Quaternion.java +++ b/jme3-core/src/main/java/com/jme3/math/Quaternion.java @@ -217,7 +217,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl /** * fromAngles 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 /** * fromAngles 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 http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm * @@ -276,8 +276,8 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl } /** - * toAngles returns this quaternion converted to Euler - * rotation angles (yaw,roll,pitch).
+ * toAngles returns this quaternion converted to Euler rotation + * angles (x,y,z) aka (pitch, yaw, roll).
* Note that the result is not always 100% accurate due to the implications of euler angles. * @see http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm * @@ -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; }