Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Chunks.Geometry.Quaternion Struct Reference

Represents a three dimensional rotation. More...

Inheritance diagram for Chunks.Geometry.Quaternion:

Public Member Functions

 Quaternion (float x, float y, float z, float w)
 Constructs a new quaternion with specific X, Y, Z and W components. Use with care. More...
 
bool Equals (Quaternion other)
 Tests for exact equivalence with another quaternion. More...
 
bool Equals (Quaternion other, float epsilon)
 Tests for approximate equivalence with another quaternion. More...
 
override bool Equals (object obj)
 Tests for equivalence with another object. More...
 
override int GetHashCode ()
 Serves as a hash function for this rotation. More...
 
override string ToString ()
 Returns a string representation of this rotation. More...
 

Static Public Member Functions

static Quaternion AxisAngle (Vector axis, float angle)
 Creates a rotation of the given angle in degrees about the given axis. More...
 
static Quaternion Euler (float x, float y, float z)
 
static Quaternion Euler (Vector eulerAngles)
 
static Quaternion LookRotation (Vector forward, Vector up)
 Creates a rotation orients an object to look in the given forward direction while pitching relative to the up vector. More...
 
static Quaternion FromTo (Quaternion a, Quaternion b)
 Gets the difference of two quaternions. More...
 
static float Angle (Quaternion a, Quaternion b)
 Gets the angle, in degrees, between two rotations. More...
 
static Quaternion Slerp (Quaternion a, Quaternion b, float t)
 Spherically interpolates between two rotations. More...
 
static Quaternion operator* (Quaternion a, Quaternion b)
 Applies the first rotation to the second. More...
 
static Vector operator* (Quaternion quat, Vector vector)
 Applies a rotation to a vector. More...
 

Public Attributes

readonly float X
 X component of the rotation. More...
 
readonly float Y
 Y component of the rotation. More...
 
readonly float Z
 Z component of the rotation. More...
 
readonly float W
 W component of the rotation. More...
 
Vector EulerAngles => new Vector(new UQuaternion(X, Y, Z, W).eulerAngles)
 

Static Public Attributes

static readonly Quaternion Identity = new Quaternion(0f, 0f, 0f, 1f)
 Represents no rotation. More...
 

Properties

Quaternion Inverse [get]
 Gets the opposite of this rotation, such that the combination of this rotation and its inverse is equivalent to no rotation. More...
 

Detailed Description

Represents a three dimensional rotation.

Constructor & Destructor Documentation

Chunks.Geometry.Quaternion.Quaternion ( float  x,
float  y,
float  z,
float  w 
)

Constructs a new quaternion with specific X, Y, Z and W components. Use with care.

Parameters
xX component of the rotation
yY component of the rotation
zZ component of the rotation
wW component of the rotation

Member Function Documentation

static float Chunks.Geometry.Quaternion.Angle ( Quaternion  a,
Quaternion  b 
)
static

Gets the angle, in degrees, between two rotations.

Parameters
aStarting rotation
bEnding rotation
static Quaternion Chunks.Geometry.Quaternion.AxisAngle ( Vector  axis,
float  angle 
)
static

Creates a rotation of the given angle in degrees about the given axis.

Parameters
axisAxis to rotate about
angleAngle in degrees to rotate by
bool Chunks.Geometry.Quaternion.Equals ( Quaternion  other)

Tests for exact equivalence with another quaternion.

Parameters
otherQuaternion to test equality with
bool Chunks.Geometry.Quaternion.Equals ( Quaternion  other,
float  epsilon 
)

Tests for approximate equivalence with another quaternion.

Parameters
otherQuaternion to test equality with
epsilonMargin of error
override bool Chunks.Geometry.Quaternion.Equals ( object  obj)

Tests for equivalence with another object.

Parameters
objObject to test equality with
static Quaternion Chunks.Geometry.Quaternion.Euler ( float  x,
float  y,
float  z 
)
static
static Quaternion Chunks.Geometry.Quaternion.Euler ( Vector  eulerAngles)
static
static Quaternion Chunks.Geometry.Quaternion.FromTo ( Quaternion  a,
Quaternion  b 
)
static

Gets the difference of two quaternions.

Parameters
aStarting rotation
bEnding rotation
override int Chunks.Geometry.Quaternion.GetHashCode ( )

Serves as a hash function for this rotation.

static Quaternion Chunks.Geometry.Quaternion.LookRotation ( Vector  forward,
Vector  up 
)
static

Creates a rotation orients an object to look in the given forward direction while pitching relative to the up vector.

Parameters
forwardDirection to look
upUpwards vector to be oriented by
static Quaternion Chunks.Geometry.Quaternion.operator* ( Quaternion  a,
Quaternion  b 
)
static

Applies the first rotation to the second.

Parameters
aRotation to apply to the other rotation
bRotation to be applied to
static Vector Chunks.Geometry.Quaternion.operator* ( Quaternion  quat,
Vector  vector 
)
static

Applies a rotation to a vector.

Parameters
quatRotation to apply to the vector
vectorVector to be applied to
static Quaternion Chunks.Geometry.Quaternion.Slerp ( Quaternion  a,
Quaternion  b,
float  t 
)
static

Spherically interpolates between two rotations.

Parameters
aStarting rotation
bEnding rotation
tInterpolation parameter, between 0.0 and 1.0
override string Chunks.Geometry.Quaternion.ToString ( )

Returns a string representation of this rotation.

Member Data Documentation

Vector Chunks.Geometry.Quaternion.EulerAngles => new Vector(new UQuaternion(X, Y, Z, W).eulerAngles)
readonly Quaternion Chunks.Geometry.Quaternion.Identity = new Quaternion(0f, 0f, 0f, 1f)
static

Represents no rotation.

readonly float Chunks.Geometry.Quaternion.W

W component of the rotation.

readonly float Chunks.Geometry.Quaternion.X

X component of the rotation.

readonly float Chunks.Geometry.Quaternion.Y

Y component of the rotation.

readonly float Chunks.Geometry.Quaternion.Z

Z component of the rotation.

Property Documentation

Quaternion Chunks.Geometry.Quaternion.Inverse
get

Gets the opposite of this rotation, such that the combination of this rotation and its inverse is equivalent to no rotation.


The documentation for this struct was generated from the following file: