Chunks
Moddable voxel sandbox for room-scale VR.
|
Represents a three dimensional rotation. More...
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... | |
Represents a three dimensional rotation.
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.
x | X component of the rotation |
y | Y component of the rotation |
z | Z component of the rotation |
w | W component of the rotation |
|
static |
Gets the angle, in degrees, between two rotations.
a | Starting rotation |
b | Ending rotation |
|
static |
Creates a rotation of the given angle in degrees about the given axis.
axis | Axis to rotate about |
angle | Angle in degrees to rotate by |
bool Chunks.Geometry.Quaternion.Equals | ( | Quaternion | other | ) |
Tests for exact equivalence with another quaternion.
other | Quaternion to test equality with |
bool Chunks.Geometry.Quaternion.Equals | ( | Quaternion | other, |
float | epsilon | ||
) |
Tests for approximate equivalence with another quaternion.
other | Quaternion to test equality with |
epsilon | Margin of error |
override bool Chunks.Geometry.Quaternion.Equals | ( | object | obj | ) |
Tests for equivalence with another object.
obj | Object to test equality with |
|
static |
|
static |
|
static |
Gets the difference of two quaternions.
a | Starting rotation |
b | Ending rotation |
override int Chunks.Geometry.Quaternion.GetHashCode | ( | ) |
Serves as a hash function for this rotation.
|
static |
Creates a rotation orients an object to look in the given forward direction while pitching relative to the up vector.
forward | Direction to look |
up | Upwards vector to be oriented by |
|
static |
Applies the first rotation to the second.
a | Rotation to apply to the other rotation |
b | Rotation to be applied to |
|
static |
Applies a rotation to a vector.
quat | Rotation to apply to the vector |
vector | Vector to be applied to |
|
static |
Spherically interpolates between two rotations.
a | Starting rotation |
b | Ending rotation |
t | Interpolation parameter, between 0.0 and 1.0 |
override string Chunks.Geometry.Quaternion.ToString | ( | ) |
Returns a string representation of this rotation.
Vector Chunks.Geometry.Quaternion.EulerAngles => new Vector(new UQuaternion(X, Y, Z, W).eulerAngles) |
|
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.
|
get |
Gets the opposite of this rotation, such that the combination of this rotation and its inverse is equivalent to no rotation.