![]() |
SystemEX
Lacking
Additional generic collection types missing in .net
|
Represents a floating‑point quaternion used for 3D rotations. More...
Public Member Functions | |
| Quatf () | |
| Initializes the identity quaternion (1,0,0,0). | |
| float | Get (int index) |
| Gets a component by index . | |
| Quatf (Vec3f angles) | |
| Initializes a quaternion from Euler angles (XYZ order). | |
| Quatf (float fs, float fx, float fy, float fz) | |
| Initializes a quaternion from explicit components. | |
| Quatf (float[] pfs) | |
| Initializes a quaternion from a float array. | |
| Quatf (AxisAngle< Vec3f, float > axisAngle) | |
| Initializes a quaternion from an axis‑angle representation. | |
| Quatf (Quatf other) | |
| Copy constructor. | |
| Vec3f | GetRotationAxis () |
| Computes the normalized rotation axis of this quaternion. | |
| float | GetRotationAngle () |
| Returns the rotation angle represented by this quaternion. | |
| CompareResult | CompareTo (Quatf a) |
| Compares two quaternions using the configured CompareMode. | |
| int IComparable< Quatf >. | CompareTo (Quatf other) |
| int | CompareTo (object? obj) |
| Compares this quaternion to another object. | |
| bool | Equals (Quatf other) |
| FixedVector< byte > | ToBytes () |
| Converts the vector into a deterministic byte sequence. | |
| override int | GetHashCode () |
| Computes a hash code for this vector. | |
| override bool | Equals (object? obj) |
| Determines whether this instance is equal to another object. | |
| Public Member Functions inherited from SystemEx.IComparableEx< T > | |
| CompareResult | CompareTo (T a) |
| Compares this instance with the specified value and returns a CompareResult describing the relationship between them. | |
Static Public Member Functions | |
| static AxisAngle< Vec3f, float > | ToAxisAngle (Quatf q) |
| Converts a quaternion into an axis‑angle representation. | |
| static Quatf | FromAxis (AxisAngle< Vec3f, float > axisAngle) |
| Creates a quaternion from an axis‑angle representation. | |
| static bool | IsIdentity (Quatf v) |
| Determines whether a quaternion is the identity rotation. | |
| static Quatf | Exponent (Quatf v) |
| Computes the quaternion exponential. | |
| static Quatf | Logarithm (Quatf v) |
| Computes the quaternion logarithm. | |
| static float | LenghtSqrt (Quatf v) |
| Computes the Euclidean length of the quaternion. | |
| static float | Lenght (Quatf v) |
| Computes the squared length of the quaternion. | |
| static Quatf | Power (Quatf v, float Exp) |
| Raises a quaternion to a scalar power. | |
| static float | DotProduct (Quatf a, Quatf b) |
| Computes the DotProduct product of two quaternions. | |
| static Quatf | Invert (Quatf q) |
| Computes the inverse of a quaternion. | |
| static Quatf | Normalize (Quatf v) |
| Normalizes a quaternion to unit length. | |
| static Quatf | Conjugate (Quatf v) |
| Computes the quaternion conjugate. | |
| static Quatf | Slerp (Quatf q0, Quatf q1, float t) |
| Performs spherical linear interpolation between two quaternions. | |
| static Quatf | operator* (Quatf a, Quatf b) |
| Multiplies two Quatf component‑wise. | |
| static Quatf | operator* (float a, Quatf b) |
| Multiplicate a float with a quaternion. | |
| static Quatf | operator* (Quatf a, float b) |
| Multiplicate a quaternion with a float. | |
| static Quatf | operator+ (Quatf a, Quatf b) |
| Adds two Quatf component‑wise. | |
| static Quatf | operator- (Quatf a, Quatf b) |
| Subtracts two Quatf component‑wise. | |
| static Quatf | operator- (Quatf a) |
| Invert. | |
| static Quatf | operator/ (Quatf a, Quatf b) |
| Divides two Quatf component‑wise. | |
| static Quatf | operator/ (Quatf a, float b) |
| Divides both components of the Quatf by a float. | |
Properties | |
| float | S [get, set] |
| Gets or sets the scalar component (w) of the quaternion. | |
| Vec3f | V [get, set] |
| Gets or sets the vector component (x,y,z) of the quaternion. | |
| float | X [get, set] |
| Gets or sets the X component of the quaternion's vector part. | |
| float | Y [get, set] |
| Gets or sets the Y component of the quaternion's vector part. | |
| float | Z [get, set] |
| Gets or sets the Z component of the quaternion's vector part. | |
| AxisAngle< Vec3f, float > | AxisAngle [get] |
| Gets the axis‑angle representation of this quaternion. | |
| CompareType | CompareMode [get, set] |
| Gets or sets the comparison mode used by CompareTo(Quatf). | |
Represents a floating‑point quaternion used for 3D rotations.
Quatf stores a scalar component w and a vector component (x,y,z) in a sequential memory layout, making it suitable for native interop, compute kernels, and deterministic hashing.
The struct is annotated with HashAlgorithmAttribute to enable attribute‑driven hashing via HashFactory.
BernsteinHash is used because it is fast, byte‑linear, and ideal for small fixed‑size numeric types.
Quatf implements multiple comparison and hashing interfaces:
| SystemEx.Numeric.Quatf.Quatf | ( | ) |
Initializes the identity quaternion (1,0,0,0).
| SystemEx.Numeric.Quatf.Quatf | ( | Vec3f | angles | ) |
Initializes a quaternion from Euler angles (XYZ order).
| SystemEx.Numeric.Quatf.Quatf | ( | float | fs, |
| float | fx, | ||
| float | fy, | ||
| float | fz ) |
Initializes a quaternion from explicit components.
| SystemEx.Numeric.Quatf.Quatf | ( | float[] | pfs | ) |
Initializes a quaternion from a float array.
Initializes a quaternion from an axis‑angle representation.
| SystemEx.Numeric.Quatf.Quatf | ( | Quatf | other | ) |
Copy constructor.
| int SystemEx.Numeric.Quatf.CompareTo | ( | object? | obj | ) |
Compares this quaternion to another object.
| CompareResult SystemEx.Numeric.Quatf.CompareTo | ( | Quatf | a | ) |
Compares two quaternions using the configured CompareMode.
Computes the quaternion conjugate.
Computes the DotProduct product of two quaternions.
| override bool SystemEx.Numeric.Quatf.Equals | ( | object? | obj | ) |
Determines whether this instance is equal to another object.
The object is considered equal if it is a Quatf and compares equal using Equals(Quatf).
| obj | The object to compare with. |
true if obj is a Quatf and equal to this instance; otherwise false. | bool SystemEx.Numeric.Quatf.Equals | ( | Quatf | other | ) |
Computes the quaternion exponential.
Creates a quaternion from an axis‑angle representation.
| float SystemEx.Numeric.Quatf.Get | ( | int | index | ) |
Gets a component by index .
| override int SystemEx.Numeric.Quatf.GetHashCode | ( | ) |
Computes a hash code for this vector.
The primary hash is generated using HashFactory and the HashAlgorithmAttribute applied to this struct.
If hashing fails (rare), a fallback XOR‑based hash is used.
| float SystemEx.Numeric.Quatf.GetRotationAngle | ( | ) |
| Vec3f SystemEx.Numeric.Quatf.GetRotationAxis | ( | ) |
Computes the normalized rotation axis of this quaternion.
Computes the inverse of a quaternion.
|
static |
Determines whether a quaternion is the identity rotation.
|
static |
Computes the squared length of the quaternion.
|
static |
Computes the Euclidean length of the quaternion.
Computes the quaternion logarithm.
Normalizes a quaternion to unit length.
Multiplicate a float with a quaternion.
Multiplicate a quaternion with a float.
Multiplies two Quatf component‑wise.
Adds two Quatf component‑wise.
Invert.
Subtracts two Quatf component‑wise.
Divides both components of the Quatf by a float.
Divides two Quatf component‑wise.
Raises a quaternion to a scalar power.
Performs spherical linear interpolation between two quaternions.
Converts a quaternion into an axis‑angle representation.
| FixedVector< byte > SystemEx.Numeric.Quatf.ToBytes | ( | ) |
Converts the vector into a deterministic byte sequence.
This method is used by HashFactory to compute attribute‑driven hashes. The byte layout is stable and platform‑safe, ensuring consistent hashing across devices and backends.
Implements SystemEx.Hash.IHashable< T >.
|
get |
Gets the axis‑angle representation of this quaternion.
|
getset |
Gets or sets the comparison mode used by CompareTo(Quatf).
|
getset |
Gets or sets the scalar component (w) of the quaternion.
|
getset |
Gets or sets the vector component (x,y,z) of the quaternion.
|
getset |
Gets or sets the X component of the quaternion's vector part.
|
getset |
Gets or sets the Y component of the quaternion's vector part.
|
getset |
Gets or sets the Z component of the quaternion's vector part.