Quaternion
Represents a double-precision Quaternion.
Implements: IEquatable<Quaternion>
Constructors
public Quaternion(Vector3 v, double w)
quaternion = Quaternion(v, w)
Construct a new Quaterniond from vector and w components
- v
- The vector part
- w
- The w part
public Quaternion(double x, double y, double z, double w)
quaternion = Quaternion(x, y, z, w)
Construct a new Quaterniond
- x
- The x component
- y
- The y component
- z
- The z component
- w
- The w component
Properties
public double Length { get; }
value = quaternion.Length
Gets the length (magnitude) of the Quaterniond.
public double LengthSquared { get; }
value = quaternion.LengthSquared
Gets the square of the Quaterniond length (magnitude).
public double W { get; set; }
value = quaternion.W
quaternion.W = value
Gets or sets the W component of this instance.
public double X { get; set; }
value = quaternion.X
quaternion.X = value
Gets or sets the X component of this instance.
public Vector3 Xyz { get; set; }
value = quaternion.Xyz
quaternion.Xyz = value
Gets or sets an OpenTK.Vector3d with the X, Y and Z components of this instance.
public double Y { get; set; }
value = quaternion.Y
quaternion.Y = value
Gets or sets the Y component of this instance.
public double Z { get; set; }
value = quaternion.Z
quaternion.Z = value
Gets or sets the Z component of this instance.
Methods
public static void Add(Quaternion left, Quaternion right, Quaternion result)
Quaternion.Add(left, right, result)
Add two quaternions
- left
- The first operand
- right
- The second operand
- result
- The result of the addition
public static Quaternion Add(Quaternion left, Quaternion right)
result = Quaternion.Add(left, right)
Add two quaternions
- left
- The first operand
- right
- The second operand
Returns: The result of the addition
public static void Conjugate(Quaternion q, Quaternion result)
Quaternion.Conjugate(q, result)
Get the conjugate of the given Quaterniond
- q
- The Quaterniond
- result
- The conjugate of the given Quaterniond
public static Quaternion Conjugate(Quaternion q)
result = Quaternion.Conjugate(q)
Get the conjugate of the given Quaterniond
- q
- The Quaterniond
Returns: The conjugate of the given Quaterniond
public bool Equals(Quaternion other)
result = quaternion.Equals(other)
Compares this Quaterniond instance to another Quaterniond for equality.
- other
- The other Quaterniond to be used in the comparison.
Returns: True if both instances are equal; false otherwise.
public override bool Equals(object other)
result = quaternion.Equals(other)
Compares this object instance to another object for equality.
- other
- The other object to be used in the comparison.
Returns: True if both objects are Quaternions of equal value. Otherwise it returns false.
public static Quaternion FromAxisAngle(Vector3 axis, double angle)
result = Quaternion.FromAxisAngle(axis, angle)
Build a Quaterniond from the given axis and angle
- axis
- The axis to rotate about
- angle
- The rotation angle in radians
public override int GetHashCode()
result = quaternion.GetHashCode()
Provides the hash code for this object.
Returns: A hash code formed from the bitwise XOR of this objects members.
public static void Invert(Quaternion q, Quaternion result)
Quaternion.Invert(q, result)
Get the inverse of the given Quaterniond
- q
- The Quaterniond to invert
- result
- The inverse of the given Quaterniond
public static Quaternion Invert(Quaternion q)
result = Quaternion.Invert(q)
Get the inverse of the given Quaterniond
- q
- The Quaterniond to invert
Returns: The inverse of the given Quaterniond
public static void Mult(Quaternion left, Quaternion right, Quaternion result)
Quaternion.Mult(left, right, result)
Multiplies two instances.
- left
- The first instance.
- right
- The second instance.
- result
- A new instance containing the result of the calculation.
public static Quaternion Mult(Quaternion left, Quaternion right)
result = Quaternion.Mult(left, right)
Multiplies two instances.
- left
- The first instance.
- right
- The second instance.
Returns: A new instance containing the result of the calculation.
public static void Multiply(Quaternion quaternion, double scale, Quaternion result)
Quaternion.Multiply(quaternion, scale, result)
Multiplies an instance by a scalar.
- quaternion
- The instance.
- scale
- The scalar.
- result
- A new instance containing the result of the calculation.
public static Quaternion Multiply(Quaternion quaternion, double scale)
result = Quaternion.Multiply(quaternion, scale)
Multiplies an instance by a scalar.
- quaternion
- The instance.
- scale
- The scalar.
Returns: A new instance containing the result of the calculation.
public static Quaternion Multiply(Quaternion left, Quaternion right)
result = Quaternion.Multiply(left, right)
Multiplies two instances.
- left
- The first instance.
- right
- The second instance.
Returns: A new instance containing the result of the calculation.
public static void Multiply(Quaternion left, Quaternion right, Quaternion result)
Quaternion.Multiply(left, right, result)
Multiplies two instances.
- left
- The first instance.
- right
- The second instance.
- result
- A new instance containing the result of the calculation.
public static Quaternion Normalize(Quaternion q)
result = Quaternion.Normalize(q)
Scale the given Quaterniond to unit length
- q
- The Quaterniond to normalize
Returns: The normalized Quaterniond
public static void Normalize(Quaternion q, Quaternion result)
Quaternion.Normalize(q, result)
Scale the given Quaterniond to unit length
- q
- The Quaterniond to normalize
- result
- The normalized Quaterniond
public static Quaternion op_Addition(Quaternion left, Quaternion right)
result = Quaternion.op_Addition(left, right)
Adds two instances.
- left
- The first instance.
- right
- The second instance.
Returns: The result of the calculation.
public static bool op_Equality(Quaternion left, Quaternion right)
result = Quaternion.op_Equality(left, right)
Compares two instances for equality.
- left
- The first instance.
- right
- The second instance.
Returns: True, if left equals right; false otherwise.
public static bool op_Inequality(Quaternion left, Quaternion right)
result = Quaternion.op_Inequality(left, right)
Compares two instances for inequality.
- left
- The first instance.
- right
- The second instance.
Returns: True, if left does not equal right; false otherwise.
public static Quaternion op_Multiply(double scale, Quaternion quaternion)
result = Quaternion.op_Multiply(scale, quaternion)
Multiplies an instance by a scalar.
- quaternion
- The instance.
- scale
- The scalar.
Returns: A new instance containing the result of the calculation.
public static Quaternion op_Multiply(Quaternion quaternion, double scale)
result = Quaternion.op_Multiply(quaternion, scale)
Multiplies an instance by a scalar.
- quaternion
- The instance.
- scale
- The scalar.
Returns: A new instance containing the result of the calculation.
public static Quaternion op_Multiply(Quaternion left, Quaternion right)
result = Quaternion.op_Multiply(left, right)
Multiplies two instances.
- left
- The first instance.
- right
- The second instance.
Returns: The result of the calculation.
public static Quaternion op_Subtraction(Quaternion left, Quaternion right)
result = Quaternion.op_Subtraction(left, right)
Subtracts two instances.
- left
- The first instance.
- right
- The second instance.
Returns: The result of the calculation.
public static Quaternion Slerp(Quaternion q1, Quaternion q2, double blend)
result = Quaternion.Slerp(q1, q2, blend)
Do Spherical linear interpolation between two quaternions
- q1
- The first Quaterniond
- q2
- The second Quaterniond
- blend
- The blend factor
Returns: A smooth blend between the given quaternions
public static void Sub(Quaternion left, Quaternion right, Quaternion result)
Quaternion.Sub(left, right, result)
Subtracts two instances.
- left
- The left instance.
- right
- The right instance.
- result
- The result of the operation.
public static Quaternion Sub(Quaternion left, Quaternion right)
result = Quaternion.Sub(left, right)
Subtracts two instances.
- left
- The left instance.
- right
- The right instance.
Returns: The result of the operation.
public void ToAxisAngle(Vector3 axis, double angle)
quaternion.ToAxisAngle(axis, angle)
Convert the current quaternion to axis angle representation
- axis
- The resultant axis
- angle
- The resultant angle
public Vector4 ToAxisAngle()
result = quaternion.ToAxisAngle()
Convert this instance to an axis-angle representation.
Returns: A Vector4 that is the axis-angle representation of this quaternion.
public override string ToString()
result = quaternion.ToString()
Returns a System.String that represents the current Quaterniond.
Fields
public static readonly Quaternion Identity
value = Quaternion.Identity
Defines the identity quaternion.