Quarterion
Last updated
Last updated
Represents a quaternion orientation.
public struct Quaternion
Creates a new quaternion with the supplied values.
Syntaxpublic Quaternion ([System.Runtime.CompilerServices.IsReadOnly] ref v)
Parameters
v
Initializes the quaternion from a .
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
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
Performs a scalar or dot product.
SyntaxParameters
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
Generates the corresponding quaternion.
SyntaxParameters
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
Generates the corresponding quaternion.
SyntaxParameters
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
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
Creates a new rotation with the specified direction and up vectors.
SyntaxParameters
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
Converts this rotation to a vector of euler angles
SyntaxReturns
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
The identity quaternion.
Syntax
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
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
Allows getting coordinates by index.
SyntaxThis is the default property for this class.
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
Calculates the length of this quaternion.
SyntaxReturns
The length of the quaternion.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
Calculates the length squared of this quaternion.
SyntaxReturns
The magnitude of the vector.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
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
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
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
Multiplies two quaternions.
SyntaxParameters
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
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 a Quaternion from a string.
SyntaxParameters
quaternionString
A string of the format "[X,Y,Z,W]"
Returns
The Quaternion parsed from quaternionString.
Exceptions
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
Generates the shortest rotation quaternion to rotate from one vector to another.
SyntaxParameters
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
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
Generates a string representation of the quaternion.
SyntaxReturns
The quaternion as a string.
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
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
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
The W coordinate of the quaternion.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The X coordinate of the quaternion.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The Y coordinate of the quaternion.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
The Z coordinate of the quaternion.
SyntaxValue
Remarks
RequirementsNamespace: Sansar Assembly: Sansar.Script (in Sansar.Script.dll) Assembly Versions: 1.0.0.0
public Dot ([System.Runtime.CompilerServices.IsReadOnly] ref b)
public static FromAngleAxis ( angle, [System.Runtime.CompilerServices.IsReadOnly] ref axis)
public static FromEulerAngles ([System.Runtime.CompilerServices.IsReadOnly] ref a)
public static FromLookOrthoNormal ([System.Runtime.CompilerServices.IsReadOnly] ref facing, [System.Runtime.CompilerServices.IsReadOnly] ref up, [System.Runtime.CompilerServices.IsReadOnly] ref left)
public GetEulerAngles ()
public static readonly Identity
public this [ index] { get; set; }
public Length ()
public LengthSquared ()
public static operator* ([System.Runtime.CompilerServices.IsReadOnly] ref a, [System.Runtime.CompilerServices.IsReadOnly] ref b)
public static ShortestRotation ([System.Runtime.CompilerServices.IsReadOnly] ref from, [System.Runtime.CompilerServices.IsReadOnly] ref to)
public override ToString ()
public W { get; set; }
public X { get; set; }
public Y { get; set; }
public Z { get; set; }