SHVDN  v3
An ASI plugin for Grand Theft Auto V, which allows running scripts written in any .NET language in-game. Developed by crosire https://github.com/crosire/scripthookvdotnet/
GTA.Math.Quaternion Struct Reference
Inheritance diagram for GTA.Math.Quaternion:

Public Member Functions

 Quaternion (float x, float y, float z, float w)
 Initializes a new instance of the Quaternion structure. More...
 
 Quaternion (Vector3 axis, float angle)
 Initializes a new instance of the Quaternion structure. More...
 
float Length ()
 Calculates the length of the quaternion. More...
 
float LengthSquared ()
 Calculates the squared length of the quaternion. More...
 
void Normalize ()
 Converts the quaternion into a unit quaternion. More...
 
void Conjugate ()
 Conjugates the quaternion. More...
 
void Invert ()
 Conjugates and renormalizes the quaternion. More...
 
Vector3 RotateTransform (Vector3 point)
 Rotates the point with rotation. More...
 
Vector3 RotateTransform (Vector3 point, Vector3 center)
 Rotates the point with rotation. More...
 
override string ToString ()
 Converts the value of the object to its equivalent string representation. More...
 
string ToString (string format)
 Converts the value of the object to its equivalent string representation. More...
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
override bool Equals (object obj)
 Returns a value that indicates whether the current instance is equal to a specified object. More...
 
bool Equals (Quaternion other)
 Returns a value that indicates whether the current instance is equal to the specified object. More...
 

Static Public Member Functions

static Quaternion Negate (Quaternion quaternion)
 Reverses the direction of a given quaternion. More...
 
static Quaternion Add (Quaternion left, Quaternion right)
 Adds two quaternions. More...
 
static Quaternion Subtract (Quaternion left, Quaternion right)
 Subtracts two quaternions. More...
 
static Quaternion Multiply (Quaternion left, Quaternion right)
 Multiplies two Quaternions together. More...
 
static Quaternion Multiply (Quaternion quaternion, float scale)
 Scales a quaternion by the given value. More...
 
static Quaternion Divide (Quaternion left, Quaternion right)
 Divides a quaternion by another. More...
 
static Quaternion Normalize (Quaternion quaternion)
 Converts the quaternion into a unit quaternion. More...
 
static Quaternion Conjugate (Quaternion value)
 Creates the conjugate of a specified Quaternion. More...
 
static Quaternion Invert (Quaternion quaternion)
 Conjugates and renormalizes the quaternion. More...
 
static float Dot (Quaternion left, Quaternion right)
 Calculates the dot product of two quaternions. More...
 
static Quaternion Lerp (Quaternion start, Quaternion end, float amount)
 Performs a linear interpolation between two quaternion. More...
 
static Quaternion Slerp (Quaternion start, Quaternion end, float amount)
 Interpolates between two quaternions, using spherical linear interpolation.. More...
 
static Quaternion SlerpUnclamped (Quaternion a, Quaternion b, float t)
 Interpolates between two quaternions, using spherical linear interpolation. The parameter /t/ is not clamped. More...
 
static Quaternion FromToRotation (Vector3 fromDirection, Vector3 toDirection)
 Creates a rotation which rotates from fromDirection to toDirection. More...
 
static Quaternion RotateTowards (Quaternion from, Quaternion to, float maxDegreesDelta)
 Rotates a rotation from towards to. More...
 
static float AngleBetween (Quaternion a, Quaternion b)
 Returns the angle in degrees between two rotations a and b. More...
 
static Quaternion Euler (float zaxis, float xaxis, float yaxis)
 Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order). More...
 
static Quaternion Euler (Vector3 euler)
 Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order). More...
 
static Quaternion RotationAxis (Vector3 axis, float angle)
 Creates a quaternion given a rotation and an axis. More...
 
static Quaternion RotationMatrix (Matrix matrix)
 Creates a quaternion given a rotation matrix. More...
 
static Quaternion RotationYawPitchRoll (float yaw, float pitch, float roll)
 Creates a Quaternion from the given yaw, pitch, and roll, in radians. More...
 
static Quaternion DirectionVectors (Vector3 rightVector, Vector3 forwardVector, Vector3 upVector)
 Creates a Quaternion from the given relative x, y, z axis More...
 
static void GetDirectionVectors (Quaternion quaternion, out Vector3 rightVector, out Vector3 forwardVector, out Vector3 upVector)
 Get direction vectors from the given quaternion More...
 
static Quaternion operator- (Quaternion quaternion)
 Reverses the direction of a given quaternion. More...
 
static Quaternion operator+ (Quaternion left, Quaternion right)
 Adds two quaternions. More...
 
static Quaternion operator- (Quaternion left, Quaternion right)
 Subtracts two quaternions. More...
 
static Quaternion operator* (Quaternion left, Quaternion right)
 Multiplies a quaternion by another. More...
 
static Quaternion operator* (Quaternion quaternion, float scale)
 Scales a quaternion by the given value. More...
 
static Quaternion operator* (float scale, Quaternion quaternion)
 Scales a quaternion by the given value. More...
 
static Quaternion operator/ (Quaternion left, Quaternion right)
 Divides a Quaternion by another Quaternion. More...
 
static bool operator== (Quaternion left, Quaternion right)
 Tests for equality between two objects. More...
 
static bool operator!= (Quaternion left, Quaternion right)
 Tests for inequality between two objects. More...
 
static Vector3 operator* (Quaternion rotation, Vector3 point)
 Rotates the point with rotation. More...
 
static Vector3 RotateTransform (Quaternion rotation, Vector3 point)
 Rotates the point with rotation. More...
 
static Vector3 RotateTransform (Quaternion rotation, Vector3 point, Vector3 center)
 Rotates the point with rotation. More...
 

Public Attributes

float X
 Gets or sets the X component of the quaternion. More...
 
float Y
 Gets or sets the Y component of the quaternion. More...
 
float Z
 Gets or sets the Z component of the quaternion. More...
 
float W
 Gets or sets the W component of the quaternion. More...
 
float Angle => ((System.Math.Abs(W) <= 1.0f) ? 2.0f * (float)(System.Math.Acos(W)) : 0.0f)
 Gets the angle of the quaternion. More...
 

Static Public Attributes

static Quaternion Zero => new Quaternion()
 A Quaternion with all of its components set to zero. More...
 
static Quaternion One => new Quaternion(1.0f, 1.0f, 1.0f, 1.0f)
 A Quaternion with all of its components set to one. More...
 
static Quaternion Identity => new Quaternion(0.0f, 0.0f, 0.0f, 1.0f)
 The identity Quaternion (0, 0, 0, 1). More...
 

Properties

Vector3 Axis [get]
 Gets the axis components of the quaternion. More...
 

Constructor & Destructor Documentation

◆ Quaternion() [1/2]

GTA.Math.Quaternion.Quaternion ( float  x,
float  y,
float  z,
float  w 
)

Initializes a new instance of the Quaternion structure.

Parameters
xThe X component of the quaternion.
yThe Y component of the quaternion.
zThe Z component of the quaternion.
wThe W component of the quaternion.

◆ Quaternion() [2/2]

GTA.Math.Quaternion.Quaternion ( Vector3  axis,
float  angle 
)

Initializes a new instance of the Quaternion structure.

Parameters
axisThe axis of rotation.
angleThe angle of rotation in radians.

Member Function Documentation

◆ Add()

static Quaternion GTA.Math.Quaternion.Add ( Quaternion  left,
Quaternion  right 
)
static

Adds two quaternions.

Parameters
leftThe first quaternion to add.
rightThe second quaternion to add.
Returns
The sum of the two quaternions.

◆ AngleBetween()

static float GTA.Math.Quaternion.AngleBetween ( Quaternion  a,
Quaternion  b 
)
static

Returns the angle in degrees between two rotations a and b.

Parameters
aThe first quaternion to calculate angle.
bThe second quaternion to calculate angle.
Returns
The angle in degrees between two rotations a and b.

◆ Conjugate() [1/2]

void GTA.Math.Quaternion.Conjugate ( )

Conjugates the quaternion.

◆ Conjugate() [2/2]

static Quaternion GTA.Math.Quaternion.Conjugate ( Quaternion  value)
static

Creates the conjugate of a specified Quaternion.

Parameters
valueThe Quaternion of which to return the conjugate.
Returns
A new Quaternion that is the conjugate of the specified one.

◆ DirectionVectors()

static Quaternion GTA.Math.Quaternion.DirectionVectors ( Vector3  rightVector,
Vector3  forwardVector,
Vector3  upVector 
)
static

Creates a Quaternion from the given relative x, y, z axis

The Vectors need to be perpendicular to each other

Parameters
rightVectorRelative X axis
forwardVectorRelative Y axis
upVectorRelative Z axis
Returns
The newly created quaternion.

◆ Divide()

static Quaternion GTA.Math.Quaternion.Divide ( Quaternion  left,
Quaternion  right 
)
static

Divides a quaternion by another.

Parameters
leftThe first quaternion to divide.
rightThe second quaternion to divide.
Returns
The divided quaternion.

◆ Dot()

static float GTA.Math.Quaternion.Dot ( Quaternion  left,
Quaternion  right 
)
static

Calculates the dot product of two quaternions.

Parameters
leftFirst source quaternion.
rightSecond source quaternion.
Returns
The dot product of the two quaternions.

◆ Equals() [1/2]

override bool GTA.Math.Quaternion.Equals ( object  obj)

Returns a value that indicates whether the current instance is equal to a specified object.

Parameters
objObject to make the comparison with.
Returns
true if the current instance is equal to the specified object; false otherwise.

◆ Equals() [2/2]

bool GTA.Math.Quaternion.Equals ( Quaternion  other)

Returns a value that indicates whether the current instance is equal to the specified object.

Parameters
otherObject to make the comparison with.
Returns
true if the current instance is equal to the specified object; false otherwise.

◆ Euler() [1/2]

static Quaternion GTA.Math.Quaternion.Euler ( float  zaxis,
float  xaxis,
float  yaxis 
)
static

Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).

Parameters
zaxisZ degrees.
xaxisX degrees.
yaxisY degrees.

◆ Euler() [2/2]

static Quaternion GTA.Math.Quaternion.Euler ( Vector3  euler)
static

Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).

Parameters
eulerEuler angles in degrees. euler.X = around X axis, euler.Y = around Y axis, euler.Z = around Z axis

◆ FromToRotation()

static Quaternion GTA.Math.Quaternion.FromToRotation ( Vector3  fromDirection,
Vector3  toDirection 
)
static

Creates a rotation which rotates from fromDirection to toDirection.

◆ GetDirectionVectors()

static void GTA.Math.Quaternion.GetDirectionVectors ( Quaternion  quaternion,
out Vector3  rightVector,
out Vector3  forwardVector,
out Vector3  upVector 
)
static

Get direction vectors from the given quaternion

Parameters
quaternionThe quaternion
rightVectorRightVector = relative x axis
forwardVectorForwardVector = relative y axis
upVectorUpVector = relative z axis

◆ GetHashCode()

override int GTA.Math.Quaternion.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

◆ Invert() [1/2]

void GTA.Math.Quaternion.Invert ( )

Conjugates and renormalizes the quaternion.

◆ Invert() [2/2]

static Quaternion GTA.Math.Quaternion.Invert ( Quaternion  quaternion)
static

Conjugates and renormalizes the quaternion.

Parameters
quaternionThe quaternion to conjugate and re-normalize.
Returns
The conjugated and renormalized quaternion.

◆ Length()

float GTA.Math.Quaternion.Length ( )

Calculates the length of the quaternion.

Returns
The length of the quaternion.

◆ LengthSquared()

float GTA.Math.Quaternion.LengthSquared ( )

Calculates the squared length of the quaternion.

Returns
The squared length of the quaternion.

◆ Lerp()

static Quaternion GTA.Math.Quaternion.Lerp ( Quaternion  start,
Quaternion  end,
float  amount 
)
static

Performs a linear interpolation between two quaternion.

Parameters
startStart quaternion.
endEnd quaternion.
amountValue between 0 and 1 indicating the weight of end .
Returns
The linear interpolation of the two quaternions.

This method performs the linear interpolation based on the following formula.

start + (end - start) * amount

Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

◆ Multiply() [1/2]

static Quaternion GTA.Math.Quaternion.Multiply ( Quaternion  left,
Quaternion  right 
)
static

Multiplies two Quaternions together.

Parameters
leftThe Quaternion on the left side of the multiplication.
rightThe Quaternion on the right side of the multiplication.
Returns
The result of the multiplication.

◆ Multiply() [2/2]

static Quaternion GTA.Math.Quaternion.Multiply ( Quaternion  quaternion,
float  scale 
)
static

Scales a quaternion by the given value.

Parameters
quaternionThe quaternion to scale.
scaleThe amount by which to scale the quaternion.
Returns
The scaled quaternion.

◆ Negate()

static Quaternion GTA.Math.Quaternion.Negate ( Quaternion  quaternion)
static

Reverses the direction of a given quaternion.

Parameters
quaternionThe quaternion to negate.
Returns
A quaternion facing in the opposite direction.

◆ Normalize() [1/2]

void GTA.Math.Quaternion.Normalize ( )

Converts the quaternion into a unit quaternion.

◆ Normalize() [2/2]

static Quaternion GTA.Math.Quaternion.Normalize ( Quaternion  quaternion)
static

Converts the quaternion into a unit quaternion.

Parameters
quaternionThe quaternion to normalize.
Returns
The normalized quaternion.

◆ operator!=()

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

Tests for inequality between two objects.

Parameters
leftThe first value to compare.
rightThe second value to compare.
Returns
true if left has a different value than right ; otherwise, false.

◆ operator*() [1/4]

static Quaternion GTA.Math.Quaternion.operator* ( float  scale,
Quaternion  quaternion 
)
static

Scales a quaternion by the given value.

Parameters
quaternionThe quaternion to scale.
scaleThe amount by which to scale the quaternion.
Returns
The scaled quaternion.

◆ operator*() [2/4]

static Quaternion GTA.Math.Quaternion.operator* ( Quaternion  left,
Quaternion  right 
)
static

Multiplies a quaternion by another.

Parameters
leftThe first quaternion to multiply.
rightThe second quaternion to multiply.
Returns
The multiplied quaternion.

◆ operator*() [3/4]

static Quaternion GTA.Math.Quaternion.operator* ( Quaternion  quaternion,
float  scale 
)
static

Scales a quaternion by the given value.

Parameters
quaternionThe quaternion to scale.
scaleThe amount by which to scale the quaternion.
Returns
The scaled quaternion.

◆ operator*() [4/4]

static Vector3 GTA.Math.Quaternion.operator* ( Quaternion  rotation,
Vector3  point 
)
static

Rotates the point with rotation.

Parameters
rotationThe quaternion to rotate the vector.
pointThe vector to be rotated.
Returns
The vector after rotation.

◆ operator+()

static Quaternion GTA.Math.Quaternion.operator+ ( Quaternion  left,
Quaternion  right 
)
static

Adds two quaternions.

Parameters
leftThe first quaternion to add.
rightThe second quaternion to add.
Returns
The sum of the two quaternions.

◆ operator-() [1/2]

static Quaternion GTA.Math.Quaternion.operator- ( Quaternion  left,
Quaternion  right 
)
static

Subtracts two quaternions.

Parameters
leftThe first quaternion to subtract.
rightThe second quaternion to subtract.
Returns
The difference of the two quaternions.

◆ operator-() [2/2]

static Quaternion GTA.Math.Quaternion.operator- ( Quaternion  quaternion)
static

Reverses the direction of a given quaternion.

Parameters
quaternionThe quaternion to negate.
Returns
A quaternion facing in the opposite direction.

◆ operator/()

static Quaternion GTA.Math.Quaternion.operator/ ( Quaternion  left,
Quaternion  right 
)
static

Divides a Quaternion by another Quaternion.

Parameters
leftThe source Quaternion.
rightThe divisor.
Returns
The result of the division.

◆ operator==()

static bool GTA.Math.Quaternion.operator== ( Quaternion  left,
Quaternion  right 
)
static

Tests for equality between two objects.

Parameters
leftThe first value to compare.
rightThe second value to compare.
Returns
true if left has the same value as right ; otherwise, false.

◆ RotateTowards()

static Quaternion GTA.Math.Quaternion.RotateTowards ( Quaternion  from,
Quaternion  to,
float  maxDegreesDelta 
)
static

Rotates a rotation from towards to.

Parameters
fromFrom Quaternion.
toTo Quaternion.
maxDegreesDelta

◆ RotateTransform() [1/4]

static Vector3 GTA.Math.Quaternion.RotateTransform ( Quaternion  rotation,
Vector3  point 
)
static

Rotates the point with rotation.

Parameters
rotationThe quaternion to rotate the vector.
pointThe vector to be rotated.
Returns
The vector after rotation.

◆ RotateTransform() [2/4]

static Vector3 GTA.Math.Quaternion.RotateTransform ( Quaternion  rotation,
Vector3  point,
Vector3  center 
)
static

Rotates the point with rotation.

Parameters
rotationThe quaternion to rotate the vector.
pointThe vector to be rotated.
centerThe vector representing the origin of the new coordinate system.
Returns
The vector after rotation in the original coordinate system.

◆ RotateTransform() [3/4]

Vector3 GTA.Math.Quaternion.RotateTransform ( Vector3  point)

Rotates the point with rotation.

Parameters
pointThe vector to be rotated.
Returns
The vector after rotation.

◆ RotateTransform() [4/4]

Vector3 GTA.Math.Quaternion.RotateTransform ( Vector3  point,
Vector3  center 
)

Rotates the point with rotation.

Parameters
pointThe vector to be rotated.
centerThe vector representing the origin of the new coordinate system.
Returns
The vector after rotation in the original coordinate system.

◆ RotationAxis()

static Quaternion GTA.Math.Quaternion.RotationAxis ( Vector3  axis,
float  angle 
)
static

Creates a quaternion given a rotation and an axis.

Parameters
axisThe axis of rotation.
angleThe angle of rotation in radians.
Returns
The newly created quaternion.

◆ RotationMatrix()

static Quaternion GTA.Math.Quaternion.RotationMatrix ( Matrix  matrix)
static

Creates a quaternion given a rotation matrix.

Parameters
matrixThe rotation matrix.
Returns
The newly created quaternion.

◆ RotationYawPitchRoll()

static Quaternion GTA.Math.Quaternion.RotationYawPitchRoll ( float  yaw,
float  pitch,
float  roll 
)
static

Creates a Quaternion from the given yaw, pitch, and roll, in radians.

Parameters
yawThe yaw angle, in radians, around the Z-axis.
pitchThe pitch angle, in radians, around the X-axis.
rollThe roll angle, in radians, around the Y-axis.
Returns
The newly created quaternion.

◆ Slerp()

static Quaternion GTA.Math.Quaternion.Slerp ( Quaternion  start,
Quaternion  end,
float  amount 
)
static

Interpolates between two quaternions, using spherical linear interpolation..

Parameters
startStart quaternion.
endEnd quaternion.
amountValue between 0 and 1 indicating the weight of end .
Returns
The spherical linear interpolation of the two quaternions.

◆ SlerpUnclamped()

static Quaternion GTA.Math.Quaternion.SlerpUnclamped ( Quaternion  a,
Quaternion  b,
float  t 
)
static

Interpolates between two quaternions, using spherical linear interpolation. The parameter /t/ is not clamped.

Parameters
a
b
t

◆ Subtract()

static Quaternion GTA.Math.Quaternion.Subtract ( Quaternion  left,
Quaternion  right 
)
static

Subtracts two quaternions.

Parameters
leftThe first quaternion to subtract.
rightThe second quaternion to subtract.
Returns
The difference of the two quaternions.

◆ ToString() [1/2]

override string GTA.Math.Quaternion.ToString ( )

Converts the value of the object to its equivalent string representation.

Returns
The string representation of the value of this instance.

◆ ToString() [2/2]

string GTA.Math.Quaternion.ToString ( string  format)

Converts the value of the object to its equivalent string representation.

Parameters
formatThe format.
Returns
The string representation of the value of this instance.

Member Data Documentation

◆ Angle

float GTA.Math.Quaternion.Angle => ((System.Math.Abs(W) <= 1.0f) ? 2.0f * (float)(System.Math.Acos(W)) : 0.0f)

Gets the angle of the quaternion.

◆ Identity

Quaternion GTA.Math.Quaternion.Identity => new Quaternion(0.0f, 0.0f, 0.0f, 1.0f)
static

The identity Quaternion (0, 0, 0, 1).

◆ One

Quaternion GTA.Math.Quaternion.One => new Quaternion(1.0f, 1.0f, 1.0f, 1.0f)
static

A Quaternion with all of its components set to one.

◆ W

float GTA.Math.Quaternion.W

Gets or sets the W component of the quaternion.

The W component of the quaternion.

◆ X

float GTA.Math.Quaternion.X

Gets or sets the X component of the quaternion.

The X component of the quaternion.

◆ Y

float GTA.Math.Quaternion.Y

Gets or sets the Y component of the quaternion.

The Y component of the quaternion.

◆ Z

float GTA.Math.Quaternion.Z

Gets or sets the Z component of the quaternion.

The Z component of the quaternion.

◆ Zero

Quaternion GTA.Math.Quaternion.Zero => new Quaternion()
static

A Quaternion with all of its components set to zero.

Property Documentation

◆ Axis

Vector3 GTA.Math.Quaternion.Axis
get

Gets the axis components of the quaternion.


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