|
@@ -217,7 +217,7 @@ public final class Quaternion implements Savable, Cloneable, java.io.Serializabl
|
|
|
|
|
|
/**
|
|
/**
|
|
* <code>fromAngles</code> builds a quaternion from the Euler rotation
|
|
* <code>fromAngles</code> builds a quaternion from the Euler rotation
|
|
- * angles (y,r,p).
|
|
|
|
|
|
+ * angles (x,y,z) aka (pitch, yaw, roll).
|
|
*
|
|
*
|
|
* @param angles
|
|
* @param angles
|
|
* the Euler angles of rotation (in radians).
|
|
* 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
|
|
* <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.
|
|
* 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>
|
|
* @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.
|
|
* 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>
|
|
* @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[2] = -FastMath.HALF_PI;
|
|
angles[0] = 0;
|
|
angles[0] = 0;
|
|
} else {
|
|
} 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;
|
|
return angles;
|
|
}
|
|
}
|