Class Quaternion
Structure that represents a rotation in three dimensions.
Inheritance
Namespace: Telerik.Windows.Media.Media3D
Assembly: Telerik.Windows.Controls.Charting.dll
Syntax
public sealed class Quaternion : ValueType
Remarks
Quaternions allow you to interpolate between rotation transformations applied to an object, thereby making it easier to compute smooth animations of rotations. A quaternion represents an axis of rotation and a rotation around that axis. It's possible to individually define the axis and angle of rotation of the starting and ending positions of a rotated object ,but the intermediate positions of that object during an animation are computationally uncertain. By determining a quaternion that represents the original orientation of a 3-D object and one that represents its destination orientation, you can smoothly interpolate between those orientations.
Constructors
Quaternion(Double, Double, Double, Double)
Initializes a new instance of the Quaternion structure.
Declaration
public Quaternion(double x, double y, double z, double w)
Parameters
System.Double
x
The X value of the new Quaternion structure. |
System.Double
y
The Y value of the new Quaternion structure. |
System.Double
z
The Z value of the new Quaternion structure. |
System.Double
w
The W value of the new Quaternion structure. |
Quaternion(Vector3D, Double)
Initializes a new instance of the Quaternion struct.
Declaration
public Quaternion(Vector3D axisOfRotation, double angleInDegrees)
Parameters
Vector3D
axisOfRotation
The axis of rotation. |
System.Double
angleInDegrees
The angle in degrees. |
Properties
Angle
Gets the Quaternion's angle, in degrees.
Declaration
public double Angle { get; }
Property Value
System.Double
|
Axis
Identity
Gets the identity Quaternion.
Declaration
public static Quaternion Identity { get; }
Property Value
Quaternion
|
IsIdentity
Gets a value that indicates whether the specified Quaternion is an identity Quaternion.
Declaration
public bool IsIdentity { get; }
Property Value
System.Boolean
|
IsNormalized
Gets a value that indicates whether the Quaternion is normalized.
Declaration
public bool IsNormalized { get; }
Property Value
System.Boolean
|
W
Gets or sets the w-value of this Quaternion structure.
Declaration
public double W { get; set; }
Property Value
System.Double
|
X
Gets or sets the x-value of this Quaternion structure.
Declaration
public double X { get; set; }
Property Value
System.Double
|
Y
Gets or sets the y-value of this Quaternion structure.
Declaration
public double Y { get; set; }
Property Value
System.Double
|
Z
Gets or sets the z-value of this Quaternion structure.
Declaration
public double Z { get; set; }
Property Value
System.Double
|
Methods
Add(Quaternion, Quaternion)
Adds the specified quaternions.
Declaration
public static Quaternion Add(Quaternion left, Quaternion right)
Parameters
Quaternion
left
First quaternion to add. |
Quaternion
right
Second quaternion to add. |
Returns
Quaternion
Quaternion that is the result of addition. |
Conjugate()
Replaces a quaternion with its conjugate.
Declaration
public void Conjugate()
Equals(Object)
Determines whether the specified Object is a Quaternion structure and if so, whether the X, Y, Z, and W properties of the specified Object are equal to the X, Y, Z, and W properties of this Quaternion structure.
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
The Object to compare. |
Returns
System.Boolean
true if o (the passed Object) is a Quaternion structure and if it is also identical to this Quaternion structure; otherwise, false. |
Equals(Quaternion)
Compares two Quaternion structures for equality.
Declaration
public bool Equals(Quaternion quaternion)
Parameters
Quaternion
quaternion
The instance of Quaternion to compare to this instance. |
Returns
System.Boolean
true if instances are equal; otherwise, false. |
Equals(Quaternion, Quaternion)
Compares two Quaternion structures for equality.
Declaration
public static bool Equals(Quaternion quaternion1, Quaternion quaternion2)
Parameters
Quaternion
quaternion1
The first Quaternion structure to compare. |
Quaternion
quaternion2
The second Quaternion structure to compare. |
Returns
System.Boolean
true if the X, Y, Z, and W values for quaternion1 and quaternion2 are equal; otherwise, false. |
Remarks
Two Quaternion structures are equal if the values of their X, Y, Z, and W properties are the same. Because the value of Doubles can lose precision when you perform arithmetic operations on them, a comparison between two Doubles that are logically equal might fail.
GetHashCode()
Gets a hash code for this Quaternion structure.
Declaration
public override int GetHashCode()
Returns
System.Int32
A hash code for this Quaternion structure. |
Invert()
Replaces the specified quaternion with its inverse.
Declaration
public void Invert()
Multiply(Quaternion, Quaternion)
Multiplies the specified Quaternions.
Declaration
public static Quaternion Multiply(Quaternion left, Quaternion right)
Parameters
Quaternion
left
First quaternion to multiply. |
Quaternion
right
Second quaternion to multiply. |
Returns
Quaternion
Quaternion that is the result of multiplication. |
Normalize()
Normalizes this instance.
Declaration
public void Normalize()
Parse(String)
Converts a String representation of a quaternion into the equivalent Quaternion structure.
Declaration
public static Quaternion Parse(string source)
Parameters
System.String
source
The String representation of the quaternion. |
Returns
Quaternion
The equivalent Quaternion structure. |
Slerp(Quaternion, Quaternion, Double)
Interpolates between two orientations using spherical linear interpolation.
Declaration
public static Quaternion Slerp(Quaternion from, Quaternion to, double t)
Parameters
Quaternion
from
Quaternion that represents the starting orientation. |
Quaternion
to
Quaternion that represents the ending orientation. |
System.Double
t
Interpolation coefficient. |
Returns
Quaternion
Quaternion that represents the orientation resulting from the interpolation. |
Slerp(Quaternion, Quaternion, Double, Boolean)
Interpolates between orientations, represented as Quaternion structures, using spherical linear interpolation.
Declaration
public static Quaternion Slerp(Quaternion from, Quaternion to, double t, bool useShortestPath)
Parameters
Quaternion
from
Quaternion that represents the starting orientation. |
Quaternion
to
Quaternion that represents the ending orientation. |
System.Double
t
Interpolation coefficient. |
System.Boolean
useShortestPath
Boolean that indicates whether to compute quaternions that constitute the shortest possible arc on a four-dimensional unit sphere. |
Returns
Quaternion
Quaternion that represents the orientation resulting from the interpolation. |
Subtract(Quaternion, Quaternion)
Subtracts a Quaternion from another.
Declaration
public static Quaternion Subtract(Quaternion left, Quaternion right)
Parameters
Quaternion
left
Quaternion from which to subtract. |
Quaternion
right
Quaternion to subtract from the first quaternion. |
Returns
Quaternion
Quaternion that is the result of subtraction. |
ToString()
Creates a String representation of this Quaternion structure.
Declaration
public override string ToString()
Returns
System.String
A String containing the X, Y, Z, and W values of this Quaternion structure. |
ToString(IFormatProvider)
Creates a String representation of this Quaternion structure.
Declaration
public string ToString(IFormatProvider provider)
Parameters
System.IFormatProvider
provider
The culture-specific formatting information. |
Returns
System.String
A String containing the X, Y, Z, and W values of this Quaternion structure. |
Operators
Addition(Quaternion, Quaternion)
Adds the specified quaternions.
Declaration
public static Quaternion operator +(Quaternion left, Quaternion right)
Parameters
Quaternion
left
First quaternion to add. |
Quaternion
right
Second quaternion to add. |
Returns
Quaternion
Quaternion that is the result of addition. |
Equality(Quaternion, Quaternion)
Compares two Quaternion structures for equality.
Declaration
public static bool operator ==(Quaternion quaternion1, Quaternion quaternion2)
Parameters
Quaternion
quaternion1
The first Quaternion structure to compare. |
Quaternion
quaternion2
The second Quaternion structure to compare. |
Returns
System.Boolean
true if the X, Y, Z, and W values for quaternion1 and quaternion2 are equal; otherwise, false. |
Remarks
Two Quaternion structures are equal if the values of their X, Y, Z, and W properties are the same. Because the value of Doubles can lose precision when you perform arithmetic operations on them, a comparison between two Doubles that are logically equal might fail.
Inequality(Quaternion, Quaternion)
Compares two Quaternion instances for exact inequality.
Declaration
public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2)
Parameters
Quaternion
quaternion1
The first Quaternion structure to compare. |
Quaternion
quaternion2
The second Quaternion structure to compare. |
Returns
System.Boolean
True if the two Quaternion instances are exactly unequal, false otherwise. |
Remarks
Two Quaternion structures are equal if the values of their X, Y, Z, and W properties are the same. Because the value of Doubles can lose precision when you perform arithmetic operations on them, a comparison between two Doubles that are logically equal might fail.
Multiply(Quaternion, Quaternion)
Multiplies the specified Quaternions.
Declaration
public static Quaternion operator *(Quaternion left, Quaternion right)
Parameters
Quaternion
left
First quaternion to multiply. |
Quaternion
right
Second quaternion to multiply. |
Returns
Quaternion
Quaternion that is the result of multiplication. |
Subtraction(Quaternion, Quaternion)
Subtracts a Quaternion from another.
Declaration
public static Quaternion operator -(Quaternion left, Quaternion right)
Parameters
Quaternion
left
Quaternion from which to subtract. |
Quaternion
right
Quaternion to subtract from the first quaternion. |
Returns
Quaternion
Quaternion that is the result of subtraction. |