class-description NEWS COMMUNITY STORE LABS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE LABS TOGGLE FULLSCREEN VOLLBILD AN/AUS Quaternion
A unit quaternion used for representing 3D rotations.

Quaternions are similar to Basis, which implements the matrix representation of rotations. Unlike Basis, which stores rotation, scale, and shearing, quaternions only store rotation.

Quaternions can be parametrized using both an axis-angle pair or Euler angles. Due to their compactness and the way they are stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.

Quaternion Quaternion<>():Quaternion

Constructs a default-initialized quaternion with all components set to 0.

Quaternion Quaternion<>( Quaternion from=, from:Quaternion=, ):Quaternion

Constructs a Quaternion as a copy of the given Quaternion.

Quaternion Quaternion<>( Vector3 arc_from=, arc_from:Vector3=, Vector3 arc_to=, arc_to:Vector3=, ):Quaternion

Constructs a quaternion representing the shortest arc between two points on the surface of a sphere with a radius of 1.0.

Quaternion Quaternion<>( Vector3 axis=, axis:Vector3=, float angle=, angle:float=, ):Quaternion

Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.

Quaternion Quaternion<>( Basis from=, from:Basis=, ):Quaternion

Constructs a quaternion from the given Basis.

Quaternion Quaternion<>( float x=, x:float=, float y=, y:float=, float z=, z:float=, float w=, w:float=, ):Quaternion

Constructs a quaternion defined by the given values.

bool operator !=<>( Quaternion right=, right:Quaternion=, ):bool

Returns true if the quaternions are not equal.

Note: Due to floating-point precision errors, consider using is_equal_approx instead, which is more reliable.

Quaternion operator *<>( Quaternion right=, right:Quaternion=, ):Quaternion

Composes these two quaternions by multiplying them together. This has the effect of rotating the second quaternion (the child) by the first quaternion (the parent).

Vector3 operator *<>( Vector3 right=, right:Vector3=, ):Vector3

Rotates (multiplies) the Vector3 by the given Quaternion.

Quaternion operator *<>( float right=, right:float=, ):Quaternion

Multiplies each component of the Quaternion by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.

Quaternion operator *<>( int right=, right:int=, ):Quaternion

Multiplies each component of the Quaternion by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.

Quaternion operator +<>( Quaternion right=, right:Quaternion=, ):Quaternion

Adds each component of the left Quaternion to the right Quaternion. This operation is not meaningful on its own, but it can be used as a part of a larger expression, such as approximating an intermediate rotation between two nearby rotations.

Quaternion operator -<>( Quaternion right=, right:Quaternion=, ):Quaternion

Subtracts each component of the left Quaternion by the right Quaternion. This operation is not meaningful on its own, but it can be used as a part of a larger expression.

Quaternion operator /<>( float right=, right:float=, ):Quaternion

Divides each component of the Quaternion by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.

Quaternion operator /<>( int right=, right:int=, ):Quaternion

Divides each component of the Quaternion by the given value. This operation is not meaningful on its own, but it can be used as a part of a larger expression.

bool operator ==<>( Quaternion right=, right:Quaternion=, ):bool

Returns true if the quaternions are exactly equal.

Note: Due to floating-point precision errors, consider using is_equal_approx instead, which is more reliable.

float operator []<>( int index=, index:int=, ):float

Access quaternion components using their index. q[0] is equivalent to q.x, q[1] is equivalent to q.y, q[2] is equivalent to q.z, and q[3] is equivalent to q.w.

Quaternion operator unary+<>():Quaternion

Returns the same value as if the + was not there. Unary + does nothing, but sometimes it can make your code more readable.

Quaternion operator unary-<>():Quaternion

Returns the negative value of the Quaternion. This is the same as writing Quaternion(-q.x, -q.y, -q.z, -q.w). This operation results in a quaternion that represents the same rotation.

float w<>():float

W component of the quaternion (real part).

Quaternion components should usually not be manipulated directly.

float x<>():float

X component of the quaternion (imaginary i axis part).

Quaternion components should usually not be manipulated directly.

float y<>():float

Y component of the quaternion (imaginary j axis part).

Quaternion components should usually not be manipulated directly.

float z<>():float

Z component of the quaternion (imaginary k axis part).

Quaternion components should usually not be manipulated directly.

float angle_to<>( Quaternion to=, to:Quaternion=, ):float

Returns the angle between this quaternion and to. This is the magnitude of the angle you would need to rotate by to get from one to the other.

Note: The magnitude of the floating-point error for this method is abnormally high, so methods such as is_zero_approx will not work reliably.

float dot<>( Quaternion with=, with:Quaternion=, ):float

Returns the dot product of two quaternions.

Quaternion exp<>():Quaternion

Returns the exponential of this quaternion. The rotation axis of the result is the normalized rotation axis of this quaternion, the angle of the result is the length of the vector part of this quaternion.

Quaternion from_euler<>( Vector3 euler=, euler:Vector3=, ):Quaternion

Constructs a Quaternion from Euler angles in YXZ rotation order.

float get_angle<>():float

Returns the angle of the rotation represented by this quaternion.

Note: The quaternion must be normalized.

Vector3 get_axis<>():Vector3

Returns the rotation axis of the rotation represented by this quaternion.

Vector3 get_euler<>( int order=2, order:int=2, ):Vector3

Returns the quaternion's rotation in the form of Euler angles. The Euler order depends on the order parameter, for example using the YXZ convention: since this method decomposes, first Z, then X, and Y last. See the EulerOrder enum for possible values. The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).

Quaternion inverse<>():Quaternion

Returns the inverse of the quaternion.

bool is_equal_approx<>( Quaternion to=, to:Quaternion=, ):bool

Returns true if this quaternion and to are approximately equal, by running @GlobalScope.is_equal_approx on each component.

bool is_finite<>():bool

Returns true if this quaternion is finite, by calling @GlobalScope.is_finite on each component.

bool is_normalized<>():bool

Returns whether the quaternion is normalized or not.

float length<>():float

Returns the length of the quaternion.

float length_squared<>():float

Returns the length of the quaternion, squared.

Quaternion log<>():Quaternion

Returns the logarithm of this quaternion. The vector part of the result is the rotation axis of this quaternion multiplied by its rotation angle, the real part of the result is zero.

Quaternion normalized<>():Quaternion

Returns a copy of the quaternion, normalized to unit length.

Quaternion slerp<>( Quaternion to=, to:Quaternion=, float weight=, weight:float=, ):Quaternion

Returns the result of the spherical linear interpolation between this quaternion and to by amount weight.

Note: Both quaternions must be normalized.

Quaternion slerpni<>( Quaternion to=, to:Quaternion=, float weight=, weight:float=, ):Quaternion

Returns the result of the spherical linear interpolation between this quaternion and to by amount weight, but without checking if the rotation path is not bigger than 90 degrees.

Quaternion spherical_cubic_interpolate<>( Quaternion b=, b:Quaternion=, Quaternion pre_a=, pre_a:Quaternion=, Quaternion post_b=, post_b:Quaternion=, float weight=, weight:float=, ):Quaternion

Performs a spherical cubic interpolation between quaternions pre_a, this vector, b, and post_b, by the given amount weight.

Quaternion spherical_cubic_interpolate_in_time<>( Quaternion b=, b:Quaternion=, Quaternion pre_a=, pre_a:Quaternion=, Quaternion post_b=, post_b:Quaternion=, float weight=, weight:float=, float b_t=, b_t:float=, float pre_a_t=, pre_a_t:float=, float post_b_t=, post_b_t:float=, ):Quaternion

Performs a spherical cubic interpolation between quaternions pre_a, this vector, b, and post_b, by the given amount weight.

It can perform smoother interpolation than spherical_cubic_interpolate by the time values.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...