C# Class BEPUutilities.Quaternion

Provides XNA-like quaternion support.
Show file Open project: tonypeng/Bloxel Class Usage Examples

Public Properties

Property Type Description
W float
X float
Y float
Z float

Public Methods

Method Description
Add ( &a, &b, &result ) : void

Adds two quaternions together.

Concatenate ( a, b ) : Quaternion

Multiplies two quaternions together in opposite order.

Concatenate ( &a, &b, &result ) : void

Multiplies two quaternions together in opposite order.

Conjugate ( quaternion ) : Quaternion

Computes the conjugate of the quaternion.

Conjugate ( &quaternion, &result ) : void

Computes the conjugate of the quaternion.

CreateFromAxisAngle ( BEPUutilities.Vector3 axis, float angle ) : Quaternion

Creates a quaternion from an axis and angle.

CreateFromAxisAngle ( BEPUutilities.Vector3 &axis, float angle, &q ) : void

Creates a quaternion from an axis and angle.

CreateFromRotationMatrix ( BEPUutilities.Matrix r ) : Quaternion

Creates a quaternion from a rotation matrix.

CreateFromRotationMatrix ( Matrix3x3 r ) : Quaternion

Creates a quaternion from a rotation matrix.

CreateFromRotationMatrix ( BEPUutilities.Matrix &r, &q ) : void

Constructs a quaternion from a rotation matrix.

CreateFromRotationMatrix ( Matrix3x3 &r, &q ) : void

Constructs a quaternion from a rotation matrix.

CreateFromYawPitchRoll ( float yaw, float pitch, float roll ) : Quaternion

Constructs a quaternion from yaw, pitch, and roll.

CreateFromYawPitchRoll ( float yaw, float pitch, float roll, &q ) : void

Constructs a quaternion from yaw, pitch, and roll.

Equals ( other ) : bool

Indicates whether the current object is equal to another object of the same type.

Equals ( object obj ) : bool

Indicates whether this instance and a specified object are equal.

GetAngleFromQuaternion ( &q ) : float

Computes the angle change represented by a normalized quaternion.

GetAxisAngleFromQuaternion ( &q, BEPUutilities.Vector3 &axis, float &angle ) : void

Computes the axis angle representation of a normalized quaternion.

GetHashCode ( ) : int

Returns the hash code for this instance.

GetLocalRotation ( &rotation, &targetBasis, &localRotation ) : void

Transforms the rotation into the local space of the target basis such that rotation = Quaternion.Concatenate(localRotation, targetBasis)

GetQuaternionBetweenNormalizedVectors ( BEPUutilities.Vector3 &v1, BEPUutilities.Vector3 &v2, &q ) : void

Computes the quaternion rotation between two normalized vectors.

GetRelativeRotation ( &start, &end, &relative ) : void

Computes the rotation from the start orientation to the end orientation such that end = Quaternion.Concatenate(start, relative).

Inverse ( quaternion ) : Quaternion

Computes the inverse of the quaternion.

Inverse ( &quaternion, &result ) : void

Computes the inverse of the quaternion.

Length ( ) : float

Computes the length of the quaternion.

LengthSquared ( ) : float

Computes the squared length of the quaternion.

Multiply ( &a, &b, &result ) : void

Multiplies two quaternions.

Multiply ( &q, float scale, &result ) : void

Scales a quaternion.

Normalize ( quaternion ) : Quaternion

Ensures the quaternion has unit length.

Normalize ( ) : void

Scales the quaternion such that it has unit length.

Normalize ( &quaternion, &toReturn ) : void

Ensures the quaternion has unit length.

Quaternion ( float x, float y, float z, float w ) : System

Constructs a new Quaternion.

Slerp ( start, end, float interpolationAmount ) : Quaternion

Blends two quaternions together to get an intermediate state.

Slerp ( &start, &end, float interpolationAmount, &result ) : void

Blends two quaternions together to get an intermediate state.

Transform ( Vector3 v, rotation ) : Vector3

Transforms the vector using a quaternion.

Transform ( Vector3 &v, &rotation, Vector3 &result ) : void

Transforms the vector using a quaternion.

TransformX ( float x, &rotation, Vector3 &result ) : void

Transforms a vector using a quaternion. Specialized for x,0,0 vectors.

TransformY ( float y, &rotation, Vector3 &result ) : void

Transforms a vector using a quaternion. Specialized for 0,y,0 vectors.

TransformZ ( float z, &rotation, Vector3 &result ) : void

Transforms a vector using a quaternion. Specialized for 0,0,z vectors.

operator ( ) : Quaternion

Multiplies two quaternions.

operator ( ) : bool

Tests components for equality.

Method Details

Add() public static method

Adds two quaternions together.
public static Add ( &a, &b, &result ) : void
a First quaternion to add.
b Second quaternion to add.
result Sum of the addition.
return void

Concatenate() public static method

Multiplies two quaternions together in opposite order.
public static Concatenate ( a, b ) : Quaternion
a First quaternion to multiply.
b Second quaternion to multiply.
return Quaternion

Concatenate() public static method

Multiplies two quaternions together in opposite order.
public static Concatenate ( &a, &b, &result ) : void
a First quaternion to multiply.
b Second quaternion to multiply.
result Product of the multiplication.
return void

Conjugate() public static method

Computes the conjugate of the quaternion.
public static Conjugate ( quaternion ) : Quaternion
quaternion Quaternion to conjugate.
return Quaternion

Conjugate() public static method

Computes the conjugate of the quaternion.
public static Conjugate ( &quaternion, &result ) : void
quaternion Quaternion to conjugate.
result Conjugated quaternion.
return void

CreateFromAxisAngle() public static method

Creates a quaternion from an axis and angle.
public static CreateFromAxisAngle ( BEPUutilities.Vector3 axis, float angle ) : Quaternion
axis BEPUutilities.Vector3 Axis of rotation.
angle float Angle to rotate around the axis.
return Quaternion

CreateFromAxisAngle() public static method

Creates a quaternion from an axis and angle.
public static CreateFromAxisAngle ( BEPUutilities.Vector3 &axis, float angle, &q ) : void
axis BEPUutilities.Vector3 Axis of rotation.
angle float Angle to rotate around the axis.
q Quaternion representing the axis and angle rotation.
return void

CreateFromRotationMatrix() public static method

Creates a quaternion from a rotation matrix.
public static CreateFromRotationMatrix ( BEPUutilities.Matrix r ) : Quaternion
r BEPUutilities.Matrix Rotation matrix used to create a new quaternion.
return Quaternion

CreateFromRotationMatrix() public static method

Creates a quaternion from a rotation matrix.
public static CreateFromRotationMatrix ( Matrix3x3 r ) : Quaternion
r Matrix3x3 Rotation matrix used to create a new quaternion.
return Quaternion

CreateFromRotationMatrix() public static method

Constructs a quaternion from a rotation matrix.
public static CreateFromRotationMatrix ( BEPUutilities.Matrix &r, &q ) : void
r BEPUutilities.Matrix Rotation matrix to create the quaternion from.
q Quaternion based on the rotation matrix.
return void

CreateFromRotationMatrix() public static method

Constructs a quaternion from a rotation matrix.
public static CreateFromRotationMatrix ( Matrix3x3 &r, &q ) : void
r Matrix3x3 Rotation matrix to create the quaternion from.
q Quaternion based on the rotation matrix.
return void

CreateFromYawPitchRoll() public static method

Constructs a quaternion from yaw, pitch, and roll.
public static CreateFromYawPitchRoll ( float yaw, float pitch, float roll ) : Quaternion
yaw float Yaw of the rotation.
pitch float Pitch of the rotation.
roll float Roll of the rotation.
return Quaternion

CreateFromYawPitchRoll() public static method

Constructs a quaternion from yaw, pitch, and roll.
public static CreateFromYawPitchRoll ( float yaw, float pitch, float roll, &q ) : void
yaw float Yaw of the rotation.
pitch float Pitch of the rotation.
roll float Roll of the rotation.
q Quaternion representing the yaw, pitch, and roll.
return void

Equals() public method

Indicates whether the current object is equal to another object of the same type.
public Equals ( other ) : bool
other An object to compare with this object.
return bool

Equals() public method

Indicates whether this instance and a specified object are equal.
public Equals ( object obj ) : bool
obj object Another object to compare to.
return bool

GetAngleFromQuaternion() public static method

Computes the angle change represented by a normalized quaternion.
public static GetAngleFromQuaternion ( &q ) : float
q Quaternion to be converted.
return float

GetAxisAngleFromQuaternion() public static method

Computes the axis angle representation of a normalized quaternion.
public static GetAxisAngleFromQuaternion ( &q, BEPUutilities.Vector3 &axis, float &angle ) : void
q Quaternion to be converted.
axis BEPUutilities.Vector3 Axis represented by the quaternion.
angle float Angle around the axis represented by the quaternion.
return void

GetHashCode() public method

Returns the hash code for this instance.
public GetHashCode ( ) : int
return int

GetLocalRotation() public static method

Transforms the rotation into the local space of the target basis such that rotation = Quaternion.Concatenate(localRotation, targetBasis)
public static GetLocalRotation ( &rotation, &targetBasis, &localRotation ) : void
rotation Rotation in the original frame of reference.
targetBasis Basis in the original frame of reference to transform the rotation into.
localRotation Rotation in the local space of the target basis.
return void

GetQuaternionBetweenNormalizedVectors() public static method

Computes the quaternion rotation between two normalized vectors.
public static GetQuaternionBetweenNormalizedVectors ( BEPUutilities.Vector3 &v1, BEPUutilities.Vector3 &v2, &q ) : void
v1 BEPUutilities.Vector3 First unit-length vector.
v2 BEPUutilities.Vector3 Second unit-length vector.
q Quaternion representing the rotation from v1 to v2.
return void

GetRelativeRotation() public static method

Computes the rotation from the start orientation to the end orientation such that end = Quaternion.Concatenate(start, relative).
public static GetRelativeRotation ( &start, &end, &relative ) : void
start Starting orientation.
end Ending orientation.
relative Relative rotation from the start to the end orientation.
return void

Inverse() public static method

Computes the inverse of the quaternion.
public static Inverse ( quaternion ) : Quaternion
quaternion Quaternion to invert.
return Quaternion

Inverse() public static method

Computes the inverse of the quaternion.
public static Inverse ( &quaternion, &result ) : void
quaternion Quaternion to invert.
result Result of the inversion.
return void

Length() public method

Computes the length of the quaternion.
public Length ( ) : float
return float

LengthSquared() public method

Computes the squared length of the quaternion.
public LengthSquared ( ) : float
return float

Multiply() public static method

Multiplies two quaternions.
public static Multiply ( &a, &b, &result ) : void
a First quaternion to multiply.
b Second quaternion to multiply.
result Product of the multiplication.
return void

Multiply() public static method

Scales a quaternion.
public static Multiply ( &q, float scale, &result ) : void
q Quaternion to multiply.
scale float Amount to multiply each component of the quaternion by.
result Scaled quaternion.
return void

Normalize() public static method

Ensures the quaternion has unit length.
public static Normalize ( quaternion ) : Quaternion
quaternion Quaternion to normalize.
return Quaternion

Normalize() public method

Scales the quaternion such that it has unit length.
public Normalize ( ) : void
return void

Normalize() public static method

Ensures the quaternion has unit length.
public static Normalize ( &quaternion, &toReturn ) : void
quaternion Quaternion to normalize.
toReturn Normalized quaternion.
return void

Quaternion() public method

Constructs a new Quaternion.
public Quaternion ( float x, float y, float z, float w ) : System
x float X component of the quaternion.
y float Y component of the quaternion.
z float Z component of the quaternion.
w float W component of the quaternion.
return System

Slerp() public static method

Blends two quaternions together to get an intermediate state.
public static Slerp ( start, end, float interpolationAmount ) : Quaternion
start Starting point of the interpolation.
end Ending point of the interpolation.
interpolationAmount float Amount of the end point to use.
return Quaternion

Slerp() public static method

Blends two quaternions together to get an intermediate state.
public static Slerp ( &start, &end, float interpolationAmount, &result ) : void
start Starting point of the interpolation.
end Ending point of the interpolation.
interpolationAmount float Amount of the end point to use.
result Interpolated intermediate quaternion.
return void

Transform() public static method

Transforms the vector using a quaternion.
public static Transform ( Vector3 v, rotation ) : Vector3
v Vector3 Vector to transform.
rotation Rotation to apply to the vector.
return Vector3

Transform() public static method

Transforms the vector using a quaternion.
public static Transform ( Vector3 &v, &rotation, Vector3 &result ) : void
v Vector3 Vector to transform.
rotation Rotation to apply to the vector.
result Vector3 Transformed vector.
return void

TransformX() public static method

Transforms a vector using a quaternion. Specialized for x,0,0 vectors.
public static TransformX ( float x, &rotation, Vector3 &result ) : void
x float X component of the vector to transform.
rotation Rotation to apply to the vector.
result Vector3 Transformed vector.
return void

TransformY() public static method

Transforms a vector using a quaternion. Specialized for 0,y,0 vectors.
public static TransformY ( float y, &rotation, Vector3 &result ) : void
y float Y component of the vector to transform.
rotation Rotation to apply to the vector.
result Vector3 Transformed vector.
return void

TransformZ() public static method

Transforms a vector using a quaternion. Specialized for 0,0,z vectors.
public static TransformZ ( float z, &rotation, Vector3 &result ) : void
z float Z component of the vector to transform.
rotation Rotation to apply to the vector.
result Vector3 Transformed vector.
return void

operator() public static method

Multiplies two quaternions.
public static operator ( ) : Quaternion
return Quaternion

operator() public static method

Tests components for equality.
public static operator ( ) : bool
return bool

Property Details

W public property

W component of the quaternion.
public float W
return float

X public property

X component of the quaternion.
public float X
return float

Y public property

Y component of the quaternion.
public float Y
return float

Z public property

Z component of the quaternion.
public float Z
return float