diff --git a/src/OpenTK/Math/Quaternion.cs b/src/OpenTK/Math/Quaternion.cs
index bea308bc..ddd6cda6 100644
--- a/src/OpenTK/Math/Quaternion.cs
+++ b/src/OpenTK/Math/Quaternion.cs
@@ -66,34 +66,36 @@ namespace OpenTK
{ }
///
- /// Construct a new Quaternion from given Euler angles
+ /// Construct a new Quaternion from given Euler angles. The rotations will get applied in following order:
+ /// 1. Around X, 2. Around Y, 3. Around Z
///
- /// The pitch (attitude), rotation around X axis
- /// The yaw (heading), rotation around Y axis
- /// The roll (bank), rotation around Z axis
- public Quaternion(float pitch, float yaw, float roll)
+ /// Counterclockwise rotation around X axis in radian
+ /// Counterclockwise rotation around Y axis in radian
+ /// Counterclockwise rotation around Z axis in radian
+ public Quaternion(float rotationX, float rotationY, float rotationZ)
{
- yaw *= 0.5f;
- pitch *= 0.5f;
- roll *= 0.5f;
+ rotationX *= 0.5f;
+ rotationY *= 0.5f;
+ rotationZ *= 0.5f;
- float c1 = (float)Math.Cos(yaw);
- float c2 = (float)Math.Cos(pitch);
- float c3 = (float)Math.Cos(roll);
- float s1 = (float)Math.Sin(yaw);
- float s2 = (float)Math.Sin(pitch);
- float s3 = (float)Math.Sin(roll);
+ float c1 = (float)Math.Cos(rotationX);
+ float c2 = (float)Math.Cos(rotationY);
+ float c3 = (float)Math.Cos(rotationZ);
+ float s1 = (float)Math.Sin(rotationX);
+ float s2 = (float)Math.Sin(rotationY);
+ float s3 = (float)Math.Sin(rotationZ);
W = c1 * c2 * c3 - s1 * s2 * s3;
- Xyz.X = s1 * s2 * c3 + c1 * c2 * s3;
- Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3;
- Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3;
+ Xyz.X = s1 * c2 * c3 + c1 * s2 * s3;
+ Xyz.Y = c1 * s2 * c3 - s1 * c2 * s3;
+ Xyz.Z = c1 * c2 * s3 + s1 * s2 * c3;
}
///
- /// Construct a new Quaternion from given Euler angles
+ /// Construct a new Quaternion from given Euler angles. The rotations will get applied in following order:
+ /// 1. Around X, 2. Around Y, 3. Around Z
///
- /// The euler angles as a Vector3
+ /// The counterclockwise euler angles as a Vector3
public Quaternion(Vector3 eulerAngles)
: this(eulerAngles.X, eulerAngles.Y, eulerAngles.Z)
{ }
@@ -431,10 +433,12 @@ namespace OpenTK
///
/// Builds a Quaternion from the given euler angles
+ /// The rotations will get applied in following order:
+ /// 1. pitch, 2. yaw, 3. roll
///
- /// The pitch (attitude), rotation around X axis
- /// The yaw (heading), rotation around Y axis
- /// The roll (bank), rotation around Z axis
+ /// The pitch (attitude), counterclockwise rotation around X axis
+ /// The yaw (heading), counterclockwise rotation around Y axis
+ /// The roll (bank), counterclockwise rotation around Z axis
///
public static Quaternion FromEulerAngles(float pitch, float yaw, float roll)
{
@@ -443,8 +447,10 @@ namespace OpenTK
///
/// Builds a Quaternion from the given euler angles
+ /// The rotations will get applied in following order:
+ /// 1. Around X, 2. Around Y, 3. Around Z
///
- /// The euler angles as a vector
+ /// The counterclockwise euler angles as a vector
/// The equivalent Quaternion
public static Quaternion FromEulerAngles(Vector3 eulerAngles)
{
@@ -452,23 +458,26 @@ namespace OpenTK
}
///
- /// Builds a Quaternion from the given euler angles
+ /// Builds a Quaternion from the given euler angles in radians.
+ /// The rotations will get applied in following order:
+ /// 1. Around X, 2. Around Y, 3. Around Z
///
- /// The euler angles a vector
+ /// The counterclockwise euler angles a vector
/// The equivalent Quaternion
public static void FromEulerAngles(ref Vector3 eulerAngles, out Quaternion result)
{
- float c1 = (float)Math.Cos(eulerAngles.Y * 0.5f);
- float c2 = (float)Math.Cos(eulerAngles.X * 0.5f);
+
+ float c1 = (float)Math.Cos(eulerAngles.X * 0.5f);
+ float c2 = (float)Math.Cos(eulerAngles.Y * 0.5f);
float c3 = (float)Math.Cos(eulerAngles.Z * 0.5f);
- float s1 = (float)Math.Sin(eulerAngles.Y * 0.5f);
- float s2 = (float)Math.Sin(eulerAngles.X * 0.5f);
+ float s1 = (float)Math.Sin(eulerAngles.X * 0.5f);
+ float s2 = (float)Math.Sin(eulerAngles.Y * 0.5f);
float s3 = (float)Math.Sin(eulerAngles.Z * 0.5f);
result.W = c1 * c2 * c3 - s1 * s2 * s3;
- result.Xyz.X = s1 * s2 * c3 + c1 * c2 * s3;
- result.Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3;
- result.Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3;
+ result.Xyz.X = s1 * c2 * c3 + c1 * s2 * s3;
+ result.Xyz.Y = c1 * s2 * c3 - s1 * c2 * s3;
+ result.Xyz.Z = c1 * c2 * s3 + s1 * s2 * c3;
}
///