The Open Toolkit library  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
OpenTK.Quaternion Struct Reference

Represents a Quaternion. More...

Inherits IEquatable< Quaternion >.

Public Member Functions

 Quaternion (Vector3 v, float w)
 Construct a new Quaternion from vector and w components More...
 
 Quaternion (float x, float y, float z, float w)
 Construct a new Quaternion More...
 
void ToAxisAngle (out Vector3 axis, out float angle)
 Convert the current quaternion to axis angle representation More...
 
Vector4 ToAxisAngle ()
 Convert this instance to an axis-angle representation. More...
 
Quaternion Normalized ()
 Returns a copy of the Quaternion scaled to unit length. More...
 
void Invert ()
 Reverses the rotation angle of this Quaterniond. More...
 
Quaternion Inverted ()
 Returns a copy of this Quaterniond with its rotation angle reversed. More...
 
void Normalize ()
 Scales the Quaternion to unit length. More...
 
void Conjugate ()
 Inverts the Vector3 component of this Quaternion. More...
 
override string ToString ()
 Returns a System.String that represents the current Quaternion. More...
 
override bool Equals (object other)
 Compares this object instance to another object for equality. More...
 
override int GetHashCode ()
 Provides the hash code for this object. More...
 
bool Equals (Quaternion other)
 Compares this Quaternion instance to another Quaternion for equality. More...
 

Static Public Member Functions

static Quaternion Add (Quaternion left, Quaternion right)
 Add two quaternions More...
 
static void Add (ref Quaternion left, ref Quaternion right, out Quaternion result)
 Add two quaternions More...
 
static Quaternion Sub (Quaternion left, Quaternion right)
 Subtracts two instances. More...
 
static void Sub (ref Quaternion left, ref Quaternion right, out Quaternion result)
 Subtracts two instances. More...
 
static Quaternion Mult (Quaternion left, Quaternion right)
 Multiplies two instances. More...
 
static void Mult (ref Quaternion left, ref Quaternion right, out Quaternion result)
 Multiplies two instances. More...
 
static Quaternion Multiply (Quaternion left, Quaternion right)
 Multiplies two instances. More...
 
static void Multiply (ref Quaternion left, ref Quaternion right, out Quaternion result)
 Multiplies two instances. More...
 
static void Multiply (ref Quaternion quaternion, float scale, out Quaternion result)
 Multiplies an instance by a scalar. More...
 
static Quaternion Multiply (Quaternion quaternion, float scale)
 Multiplies an instance by a scalar. More...
 
static Quaternion Conjugate (Quaternion q)
 Get the conjugate of the given quaternion More...
 
static void Conjugate (ref Quaternion q, out Quaternion result)
 Get the conjugate of the given quaternion More...
 
static Quaternion Invert (Quaternion q)
 Get the inverse of the given quaternion More...
 
static void Invert (ref Quaternion q, out Quaternion result)
 Get the inverse of the given quaternion More...
 
static Quaternion Normalize (Quaternion q)
 Scale the given quaternion to unit length More...
 
static void Normalize (ref Quaternion q, out Quaternion result)
 Scale the given quaternion to unit length More...
 
static Quaternion FromAxisAngle (Vector3 axis, float angle)
 Build a quaternion from the given axis and angle More...
 
static Quaternion FromMatrix (Matrix3 matrix)
 Builds a quaternion from the given rotation matrix More...
 
static void FromMatrix (ref Matrix3 matrix, out Quaternion result)
 Builds a quaternion from the given rotation matrix More...
 
static Quaternion Slerp (Quaternion q1, Quaternion q2, float blend)
 Do Spherical linear interpolation between two quaternions More...
 
static Quaternion operator+ (Quaternion left, Quaternion right)
 Adds two instances. More...
 
static Quaternion operator- (Quaternion left, Quaternion right)
 Subtracts two instances. More...
 
static Quaternion operator* (Quaternion left, Quaternion right)
 Multiplies two instances. More...
 
static Quaternion operator* (Quaternion quaternion, float scale)
 Multiplies an instance by a scalar. More...
 
static Quaternion operator* (float scale, Quaternion quaternion)
 Multiplies an instance by a scalar. More...
 
static bool operator== (Quaternion left, Quaternion right)
 Compares two instances for equality. More...
 
static bool operator!= (Quaternion left, Quaternion right)
 Compares two instances for inequality. More...
 

Public Attributes

Vector3 xyz
 
float w
 

Static Public Attributes

static readonly Quaternion Identity = new Quaternion(0, 0, 0, 1)
 Defines the identity quaternion. More...
 

Properties

Vector3 XYZ [get, set]
 Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance. More...
 
Vector3 Xyz [get, set]
 Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance. More...
 
float X [get, set]
 Gets or sets the X component of this instance. More...
 
float Y [get, set]
 Gets or sets the Y component of this instance. More...
 
float Z [get, set]
 Gets or sets the Z component of this instance. More...
 
float W [get, set]
 Gets or sets the W component of this instance. More...
 
float Length [get]
 Gets the length (magnitude) of the quaternion. More...
 
float LengthSquared [get]
 Gets the square of the quaternion length (magnitude). More...
 

Detailed Description

Represents a Quaternion.

Constructor & Destructor Documentation

OpenTK.Quaternion.Quaternion ( Vector3  v,
float  w 
)

Construct a new Quaternion from vector and w components

Parameters
vThe vector part
wThe w part
OpenTK.Quaternion.Quaternion ( float  x,
float  y,
float  z,
float  w 
)

Construct a new Quaternion

Parameters
xThe x component
yThe y component
zThe z component
wThe w component

Member Function Documentation

static Quaternion OpenTK.Quaternion.Add ( Quaternion  left,
Quaternion  right 
)
static

Add two quaternions

Parameters
leftThe first operand
rightThe second operand
Returns
The result of the addition
static void OpenTK.Quaternion.Add ( ref Quaternion  left,
ref Quaternion  right,
out Quaternion  result 
)
static

Add two quaternions

Parameters
leftThe first operand
rightThe second operand
resultThe result of the addition
void OpenTK.Quaternion.Conjugate ( )

Inverts the Vector3 component of this Quaternion.

static Quaternion OpenTK.Quaternion.Conjugate ( Quaternion  q)
static

Get the conjugate of the given quaternion

Parameters
qThe quaternion
Returns
The conjugate of the given quaternion
static void OpenTK.Quaternion.Conjugate ( ref Quaternion  q,
out Quaternion  result 
)
static

Get the conjugate of the given quaternion

Parameters
qThe quaternion
resultThe conjugate of the given quaternion
override bool OpenTK.Quaternion.Equals ( object  other)

Compares this object instance to another object for equality.

Parameters
otherThe other object to be used in the comparison.
Returns
True if both objects are Quaternions of equal value. Otherwise it returns false.
bool OpenTK.Quaternion.Equals ( Quaternion  other)

Compares this Quaternion instance to another Quaternion for equality.

Parameters
otherThe other Quaternion to be used in the comparison.
Returns
True if both instances are equal; false otherwise.
static Quaternion OpenTK.Quaternion.FromAxisAngle ( Vector3  axis,
float  angle 
)
static

Build a quaternion from the given axis and angle

Parameters
axisThe axis to rotate about
angleThe rotation angle in radians
Returns
The equivalent quaternion
static Quaternion OpenTK.Quaternion.FromMatrix ( Matrix3  matrix)
static

Builds a quaternion from the given rotation matrix

Parameters
matrixA rotation matrix
Returns
The equivalent quaternion
static void OpenTK.Quaternion.FromMatrix ( ref Matrix3  matrix,
out Quaternion  result 
)
static

Builds a quaternion from the given rotation matrix

Parameters
matrixA rotation matrix
resultThe equivalent quaternion
override int OpenTK.Quaternion.GetHashCode ( )

Provides the hash code for this object.

Returns
A hash code formed from the bitwise XOR of this objects members.
void OpenTK.Quaternion.Invert ( )

Reverses the rotation angle of this Quaterniond.

static Quaternion OpenTK.Quaternion.Invert ( Quaternion  q)
static

Get the inverse of the given quaternion

Parameters
qThe quaternion to invert
Returns
The inverse of the given quaternion
static void OpenTK.Quaternion.Invert ( ref Quaternion  q,
out Quaternion  result 
)
static

Get the inverse of the given quaternion

Parameters
qThe quaternion to invert
resultThe inverse of the given quaternion
Quaternion OpenTK.Quaternion.Inverted ( )

Returns a copy of this Quaterniond with its rotation angle reversed.

static Quaternion OpenTK.Quaternion.Mult ( Quaternion  left,
Quaternion  right 
)
static

Multiplies two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
A new instance containing the result of the calculation.
static void OpenTK.Quaternion.Mult ( ref Quaternion  left,
ref Quaternion  right,
out Quaternion  result 
)
static

Multiplies two instances.

Parameters
leftThe first instance.
rightThe second instance.
resultA new instance containing the result of the calculation.
static Quaternion OpenTK.Quaternion.Multiply ( Quaternion  left,
Quaternion  right 
)
static

Multiplies two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
A new instance containing the result of the calculation.
static void OpenTK.Quaternion.Multiply ( ref Quaternion  left,
ref Quaternion  right,
out Quaternion  result 
)
static

Multiplies two instances.

Parameters
leftThe first instance.
rightThe second instance.
resultA new instance containing the result of the calculation.
static void OpenTK.Quaternion.Multiply ( ref Quaternion  quaternion,
float  scale,
out Quaternion  result 
)
static

Multiplies an instance by a scalar.

Parameters
quaternionThe instance.
scaleThe scalar.
resultA new instance containing the result of the calculation.
static Quaternion OpenTK.Quaternion.Multiply ( Quaternion  quaternion,
float  scale 
)
static

Multiplies an instance by a scalar.

Parameters
quaternionThe instance.
scaleThe scalar.
Returns
A new instance containing the result of the calculation.
void OpenTK.Quaternion.Normalize ( )

Scales the Quaternion to unit length.

static Quaternion OpenTK.Quaternion.Normalize ( Quaternion  q)
static

Scale the given quaternion to unit length

Parameters
qThe quaternion to normalize
Returns
The normalized quaternion
static void OpenTK.Quaternion.Normalize ( ref Quaternion  q,
out Quaternion  result 
)
static

Scale the given quaternion to unit length

Parameters
qThe quaternion to normalize
resultThe normalized quaternion
Quaternion OpenTK.Quaternion.Normalized ( )

Returns a copy of the Quaternion scaled to unit length.

static bool OpenTK.Quaternion.operator!= ( Quaternion  left,
Quaternion  right 
)
static

Compares two instances for inequality.

Parameters
leftThe first instance.
rightThe second instance.
Returns
True, if left does not equal right; false otherwise.
static Quaternion OpenTK.Quaternion.operator* ( Quaternion  left,
Quaternion  right 
)
static

Multiplies two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
The result of the calculation.
static Quaternion OpenTK.Quaternion.operator* ( Quaternion  quaternion,
float  scale 
)
static

Multiplies an instance by a scalar.

Parameters
quaternionThe instance.
scaleThe scalar.
Returns
A new instance containing the result of the calculation.
static Quaternion OpenTK.Quaternion.operator* ( float  scale,
Quaternion  quaternion 
)
static

Multiplies an instance by a scalar.

Parameters
quaternionThe instance.
scaleThe scalar.
Returns
A new instance containing the result of the calculation.
static Quaternion OpenTK.Quaternion.operator+ ( Quaternion  left,
Quaternion  right 
)
static

Adds two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
The result of the calculation.
static Quaternion OpenTK.Quaternion.operator- ( Quaternion  left,
Quaternion  right 
)
static

Subtracts two instances.

Parameters
leftThe first instance.
rightThe second instance.
Returns
The result of the calculation.
static bool OpenTK.Quaternion.operator== ( Quaternion  left,
Quaternion  right 
)
static

Compares two instances for equality.

Parameters
leftThe first instance.
rightThe second instance.
Returns
True, if left equals right; false otherwise.
static Quaternion OpenTK.Quaternion.Slerp ( Quaternion  q1,
Quaternion  q2,
float  blend 
)
static

Do Spherical linear interpolation between two quaternions

Parameters
q1The first quaternion
q2The second quaternion
blendThe blend factor
Returns
A smooth blend between the given quaternions
static Quaternion OpenTK.Quaternion.Sub ( Quaternion  left,
Quaternion  right 
)
static

Subtracts two instances.

Parameters
leftThe left instance.
rightThe right instance.
Returns
The result of the operation.
static void OpenTK.Quaternion.Sub ( ref Quaternion  left,
ref Quaternion  right,
out Quaternion  result 
)
static

Subtracts two instances.

Parameters
leftThe left instance.
rightThe right instance.
resultThe result of the operation.
void OpenTK.Quaternion.ToAxisAngle ( out Vector3  axis,
out float  angle 
)

Convert the current quaternion to axis angle representation

Parameters
axisThe resultant axis
angleThe resultant angle
Vector4 OpenTK.Quaternion.ToAxisAngle ( )

Convert this instance to an axis-angle representation.

Returns
A Vector4 that is the axis-angle representation of this quaternion.
override string OpenTK.Quaternion.ToString ( )

Returns a System.String that represents the current Quaternion.

Returns

Member Data Documentation

readonly Quaternion OpenTK.Quaternion.Identity = new Quaternion(0, 0, 0, 1)
static

Defines the identity quaternion.

Property Documentation

float OpenTK.Quaternion.Length
get

Gets the length (magnitude) of the quaternion.

See Also
LengthSquared
float OpenTK.Quaternion.LengthSquared
get

Gets the square of the quaternion length (magnitude).

float OpenTK.Quaternion.W
getset

Gets or sets the W component of this instance.

float OpenTK.Quaternion.X
getset

Gets or sets the X component of this instance.

Vector3 OpenTK.Quaternion.XYZ
getset

Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance.

Vector3 OpenTK.Quaternion.Xyz
getset

Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance.

float OpenTK.Quaternion.Y
getset

Gets or sets the Y component of this instance.

float OpenTK.Quaternion.Z
getset

Gets or sets the Z component of this instance.