Quarterion
Quaternion Struct
Represents a quaternion orientation.
Syntax
public struct Quaternion
Member Details
Quaternion Constructor
Creates a new quaternion with the supplied values.
Syntaxpublic Quaternion ([System.Runtime.CompilerServices.IsReadOnly] ref Mono.Simd.Vector4f v)
Parameters
v
Initializes the quaternion from a Mono.Simd.Vector4f.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Quaternion Constructor
Creates a new quaternion with the supplied values.
SyntaxParameters
x
The x coordinate.
y
The y coordinate.
z
The z coordinate.
w
The w coordinate.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Dot Method
Performs a scalar or dot product.
Syntaxpublic float Dot ([System.Runtime.CompilerServices.IsReadOnly] ref Quaternion b)
Parameters
b
The second quaternion.
Returns
Returns X*b.X+Y*b.Y+Z*b.Z+W*b.W
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
FromAngleAxis Method
Generates the corresponding quaternion.
Syntaxpublic static Quaternion FromAngleAxis (float angle, [System.Runtime.CompilerServices.IsReadOnly] ref Vector axis)
Parameters
angle
Angle of rotation in radians
axis
A normalized axis of rotation
Returns
The corresponding quaternion.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
FromEulerAngles Method
Generates the corresponding quaternion.
Syntaxpublic static Quaternion FromEulerAngles ([System.Runtime.CompilerServices.IsReadOnly] ref Vector a)
Parameters
a
A vector of angles in radians.
Returns
The corresponding quaternion.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
FromLook Method
Creates a new rotation with the specified direction and up vectors.
SyntaxParameters
facing
The direction to look.
up
The up direction.
Returns
A new quaternion representing this rotation.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
FromLookOrthoNormal Method
Creates a new rotation with the specified direction and up vectors.
Syntaxpublic static Quaternion FromLookOrthoNormal ([System.Runtime.CompilerServices.IsReadOnly] ref Vector facing, [System.Runtime.CompilerServices.IsReadOnly] ref Vector up, [System.Runtime.CompilerServices.IsReadOnly] ref Vector left)
Parameters
facing
The direction to look.
up
The up direction.
left
The left direction.
Returns
A new quaternion representing this rotation.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
GetEulerAngles Method
Converts this rotation to a vector of euler angles
Syntaxpublic Vector GetEulerAngles ()
Returns
A vector of angles in radians corresponding to this quaternion.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Identity Field
The identity quaternion.
Syntaxpublic static readonly Quaternion Identity
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Inverse Method
Gets the Inverse of the quaternion.
SyntaxReturns
A quaternion inverse, such that q * q.Inverse() == q.Inverse() * q == Quaternion.Identity
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Item Property
Allows getting coordinates by index.
SyntaxThis is the default property for this class.
public float this [int index] { get; set; }
Parameters
index
0=>X, 1=>Y, 2=>Z, 3=>W
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Length Method
Calculates the length of this quaternion.
Syntaxpublic float Length ()
Returns
The length of the quaternion.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
LengthSquared Method
Calculates the length squared of this quaternion.
Syntaxpublic float LengthSquared ()
Returns
The magnitude of the vector.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Normalized Method
Returns a quaternion with the same orientation and unit length.
SyntaxReturns
A quaternion with the same orientation and unit length.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Conversion Method
Converts a Mono.Simd.Vector4f to a quaternion.
SyntaxParameters
v
The vector to convert
Returns
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Conversion Method
Converts a quaternion to a Mono.Simd.Vector4f.
SyntaxParameters
v
The quaternion to convert
Returns
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
op_Multiply Method
Multiplies two quaternions.
Syntaxpublic static Quaternion operator* ([System.Runtime.CompilerServices.IsReadOnly] ref Quaternion a, [System.Runtime.CompilerServices.IsReadOnly] ref Quaternion b)
Parameters
a
The first quaternion
b
The second quaternion
Returns
Returns the composed orientation for the two quaternions.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
op_UnaryNegation Method
Negates a quaternion
SyntaxParameters
q
The quaternion to negate
Returns
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Parse Method
Parse a Quaternion from a string.
SyntaxParameters
quaternionString
A string of the format "[X,Y,Z,W]"
Returns
The Quaternion parsed from quaternionString.
Exceptions
Type | Reason |
---|---|
If quaternionString is null. | |
If the string is not a valid quaternion or its components are not valid floats. |
Remarks
Example
C# Example |
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
ShortestRotation Method
Generates the shortest rotation quaternion to rotate from one vector to another.
Syntaxpublic static Quaternion ShortestRotation ([System.Runtime.CompilerServices.IsReadOnly] ref Vector from, [System.Runtime.CompilerServices.IsReadOnly] ref Vector to)
Parameters
from
Vector rotating from.
to
Vector rotating to.
Returns
The corresponding quaternion.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
ToAngleAxis Method
Gets the angle-axis representation
SyntaxParameters
angle
Angle of rotation in radians
axis
A normalized axis of rotation
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
ToString Method
Generates a string representation of the quaternion.
Syntaxpublic override string ToString ()
Returns
The quaternion as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
ToString Method
Generates a string representation of the quaternion.
SyntaxParameters
format
Format to use for each of the coordinates.
Returns
The quaternion as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
TryParse Method
Try to parse a Quaternion from a string.
SyntaxParameters
quaternionString
A string of the format "[X,Y,Z,W]"
quaternion
The quaternion that will be set if quaternionString represents a valid quaternion.
Returns
True if successfully parsed a quaternion, false if not.
Remarks
Example
C# Example |
|
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
W Property
The W coordinate of the quaternion.
Syntaxpublic float W { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
X Property
The X coordinate of the quaternion.
Syntaxpublic float X { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Y Property
The Y coordinate of the quaternion.
Syntaxpublic float Y { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Z Property
The Z coordinate of the quaternion.
Syntaxpublic float Z { get; set; }
Value
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Last updated