![]() |
SystemEX
Lacking
Additional generic collection types missing in .net
|
Represents a doubleing‑point quaternion used for 3D rotations. More...
Public Member Functions | |
| Quatd () | |
| Initializes the identity quaternion (1,0,0,0). | |
| Quatd (Vec3d angles) | |
| Initializes a quaternion from Euler angles (XYZ order). | |
| Quatd (double fs, double fx, double fy, double fz) | |
| Initializes a quaternion from explicit components. | |
| Quatd (double[] pfs) | |
| Initializes a quaternion from a double array. | |
| Quatd (AxisAngle< Vec3d, double > axisAngle) | |
| Initializes a quaternion from an axis‑angle representation. | |
| Quatd (Quatd other) | |
| Copy constructor. | |
| double | Get (int index) |
| Gets a component by index . | |
| Vec3d | GetRotationAxis () |
| Computes the normalized rotation axis of this quaternion. | |
| double | GetRotationAngle () |
| Returns the rotation angle represented by this quaternion. | |
| CompareResult | CompareTo (Quatd a) |
| Compares two quaternions using the configured CompareMode. | |
| int IComparable< Quatd >. | CompareTo (Quatd other) |
| int | CompareTo (object? obj) |
| Compares this quaternion to another object. | |
| bool | Equals (Quatd 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< Vec3d, double > | ToAxisAngle (Quatd q) |
| Converts a quaternion into an axis‑angle representation. | |
| static Quatd | FromAxis (AxisAngle< Vec3d, double > axisAngle) |
| Creates a quaternion from an axis‑angle representation. | |
| static bool | IsIdentity (Quatd v) |
| Determines whether a quaternion is the identity rotation. | |
| static Quatd | Exponent (Quatd v) |
| Computes the quaternion exponential. | |
| static Quatd | Logarithm (Quatd v) |
| Computes the quaternion logarithm. | |
| static double | LenghtSqrt (Quatd v) |
| Computes the Euclidean length of the quaternion. | |
| static double | Lenght (Quatd v) |
| Computes the squared length of the quaternion. | |
| static Quatd | Power (Quatd v, double Exp) |
| Raises a quaternion to a scalar power. | |
| static double | DotProduct (Quatd a, Quatd b) |
| Computes the DotProduct product of two quaternions. | |
| static Quatd | Invert (Quatd q) |
| Computes the inverse of a quaternion. | |
| static Quatd | Normalize (Quatd v) |
| Normalizes a quaternion to unit length. | |
| static Quatd | Conjugate (Quatd v) |
| Computes the quaternion conjugate. | |
| static Quatd | Slerp (Quatd q0, Quatd q1, double t) |
| Performs spherical linear interpolation between two quaternions. | |
| static Quatd | operator* (Quatd a, Quatd b) |
| Multiplies two Quatd component‑wise. | |
| static Quatd | operator* (double a, Quatd b) |
| Multiplicate a double with a quaternion. | |
| static Quatd | operator* (Quatd a, double b) |
| Multiplicate a quaternion with a double. | |
| static Quatd | operator+ (Quatd a, Quatd b) |
| Adds two Quatd component‑wise. | |
| static Quatd | operator- (Quatd a, Quatd b) |
| Subtracts two Quatd component‑wise. | |
| static Quatd | operator- (Quatd a) |
| Invert. | |
| static Quatd | operator/ (Quatd a, Quatd b) |
| Divides two Quatd component‑wise. | |
| static Quatd | operator/ (Quatd a, double b) |
| Divides both components of the Quatd by a double. | |
Properties | |
| double | S [get, set] |
| Gets or sets the scalar component (w) of the quaternion. | |
| Vec3d | V [get, set] |
| Gets or sets the vector component (x,y,z) of the quaternion. | |
| double | X [get, set] |
| Gets or sets the X component of the quaternion's vector part. | |
| double | Y [get, set] |
| Gets or sets the Y component of the quaternion's vector part. | |
| double | Z [get, set] |
| Gets or sets the Z component of the quaternion's vector part. | |
| AxisAngle< Vec3d, double > | AxisAngle [get] |
| Gets the axis‑angle representation of this quaternion. | |
| CompareType | CompareMode [get, set] |
| Gets or sets the comparison mode used by CompareTo(Quatd). | |
Represents a doubleing‑point quaternion used for 3D rotations.
Quatd 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.
Quatd implements multiple comparison and hashing interfaces:
| SystemEx.Numeric.Quatd.Quatd | ( | ) |
Initializes the identity quaternion (1,0,0,0).
| SystemEx.Numeric.Quatd.Quatd | ( | Vec3d | angles | ) |
Initializes a quaternion from Euler angles (XYZ order).
| SystemEx.Numeric.Quatd.Quatd | ( | double | fs, |
| double | fx, | ||
| double | fy, | ||
| double | fz ) |
Initializes a quaternion from explicit components.
| SystemEx.Numeric.Quatd.Quatd | ( | double[] | pfs | ) |
Initializes a quaternion from a double array.
Initializes a quaternion from an axis‑angle representation.
| SystemEx.Numeric.Quatd.Quatd | ( | Quatd | other | ) |
Copy constructor.
| int SystemEx.Numeric.Quatd.CompareTo | ( | object? | obj | ) |
Compares this quaternion to another object.
| CompareResult SystemEx.Numeric.Quatd.CompareTo | ( | Quatd | a | ) |
Compares two quaternions using the configured CompareMode.
Computes the quaternion conjugate.
Computes the DotProduct product of two quaternions.
| override bool SystemEx.Numeric.Quatd.Equals | ( | object? | obj | ) |
Determines whether this instance is equal to another object.
The object is considered equal if it is a Quatd and compares equal using Equals(Quatd).
| obj | The object to compare with. |
true if obj is a Quatd and equal to this instance; otherwise false. | bool SystemEx.Numeric.Quatd.Equals | ( | Quatd | other | ) |
Computes the quaternion exponential.
Creates a quaternion from an axis‑angle representation.
| double SystemEx.Numeric.Quatd.Get | ( | int | index | ) |
Gets a component by index .
| override int SystemEx.Numeric.Quatd.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.
| double SystemEx.Numeric.Quatd.GetRotationAngle | ( | ) |
| Vec3d SystemEx.Numeric.Quatd.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 double with a quaternion.
Multiplicate a quaternion with a double.
Multiplies two Quatd component‑wise.
Adds two Quatd component‑wise.
Invert.
Subtracts two Quatd component‑wise.
Divides both components of the Quatd by a double.
Divides two Quatd 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.Quatd.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(Quatd).
|
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.