SystemEX  Lacking
Additional generic collection types missing in .net
SystemEx.Numeric.Quatd Struct Reference

Represents a doubleing‑point quaternion used for 3D rotations. More...

Inheritance diagram for SystemEx.Numeric.Quatd:
Collaboration diagram for SystemEx.Numeric.Quatd:

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).

Detailed Description

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:

  • IComparable and IComparable<T> for ordering
  • IEquatable<T> for equality checks
  • IHashable<T> for deterministic byte‑level hashing

Constructor & Destructor Documentation

◆ Quatd() [1/6]

SystemEx.Numeric.Quatd.Quatd ( )

Initializes the identity quaternion (1,0,0,0).

110 {
111 m_v = new Vec3d(0);
112 m_s = 1.0;
113 m_comparebleMode = CompareType.Skalar;
114 }
CompareType
Defines the comparison mode used by Quatf.
Definition Quatf.cs:33
Here is the caller graph for this function:

◆ Quatd() [2/6]

SystemEx.Numeric.Quatd.Quatd ( Vec3d angles)

Initializes a quaternion from Euler angles (XYZ order).

118 {
119 double cos_z_2 = System.Math.Cos(0.5*angles.Z);
120 double cos_y_2 = System.Math.Cos(0.5*angles.Y);
121 double cos_x_2 = System.Math.Cos(0.5*angles.X);
122
123 double sin_z_2 = System.Math.Sin(0.5*angles.Z);
124 double sin_y_2 = System.Math.Sin(0.5*angles.Y);
125 double sin_x_2 = System.Math.Sin(0.5*angles.X);
126
127 // and now compute quaternion
128 m_s = cos_z_2 * cos_y_2 * cos_x_2 + sin_z_2 * sin_y_2 * sin_x_2;
129 m_v = new Vec3d
130 (
131 cos_z_2 * cos_y_2 * sin_x_2 - sin_z_2 * sin_y_2 * cos_x_2,
132 cos_z_2 * sin_y_2 * cos_x_2 + sin_z_2 * cos_y_2 * sin_x_2,
133 sin_z_2 * cos_y_2 * cos_x_2 - cos_z_2 * sin_y_2 * sin_x_2
134 );
135 m_comparebleMode = CompareType.Skalar;
136 }
@ System
forward indexing
Definition FlexSpan.cs:32

◆ Quatd() [3/6]

SystemEx.Numeric.Quatd.Quatd ( double fs,
double fx,
double fy,
double fz )

Initializes a quaternion from explicit components.

140 {
141 m_s = fs;
142 m_v = new Vec3d(fx, fy, fz);
143 m_comparebleMode = CompareType.Skalar;
144 }

◆ Quatd() [4/6]

SystemEx.Numeric.Quatd.Quatd ( double[] pfs)

Initializes a quaternion from a double array.

149 {
150 m_s = pfs[0];
151 m_v = new Vec3d(pfs[1], pfs[2], pfs[3]);
152 m_comparebleMode = CompareType.Skalar;
153 }

◆ Quatd() [5/6]

SystemEx.Numeric.Quatd.Quatd ( AxisAngle< Vec3d, double > axisAngle)

Initializes a quaternion from an axis‑angle representation.

158 {
159 var tmp = FromAxis(axisAngle);
160 m_s = tmp.m_s;
161 m_v = tmp.m_v;
162 m_comparebleMode = CompareType.Skalar;
163 }
Here is the call graph for this function:

◆ Quatd() [6/6]

SystemEx.Numeric.Quatd.Quatd ( Quatd other)

Copy constructor.

168 {
169 m_s = other.m_s;
170 m_v = other.m_v;
171 m_comparebleMode = CompareType.Skalar;
172 }
Here is the call graph for this function:

Member Function Documentation

◆ CompareTo() [1/3]

int SystemEx.Numeric.Quatd.CompareTo ( object? obj)

Compares this quaternion to another object.

514 {
515 if ( (obj is Quatd) ) {
516 return (int)CompareTo((Quatd)(obj));
517 }
518 throw new ArgumentException("Object is not a Quatd object");
519 }
Here is the call graph for this function:

◆ CompareTo() [2/3]

CompareResult SystemEx.Numeric.Quatd.CompareTo ( Quatd a)

Compares two quaternions using the configured CompareMode.

482 {
483
484 CompareResult _ret = CompareResult.Equal;
485
486 double _a = 0;
487 double _b = 0;
488
489 switch ( m_comparebleMode ) {
490 case CompareType.Skalar:
491 _ret = (CompareResult)m_s.CompareTo(a.m_s);
492 break;
493 case CompareType.Norm:
494 _a = m_s * m_s + Vec3d.Lenght(m_v);
495 _b = a.m_s * a.m_s + Vec3d.Lenght(a.m_v);
496 _ret = (CompareResult)_a.CompareTo(_b);
497 break;
498 case CompareType.Rotation:
499 _a = GetRotationAngle();
500 _b = a.GetRotationAngle();
501 _ret = (CompareResult)_a.CompareTo(_b);
502 break;
503 }
504 return _ret;
505 }
CompareResult
Specifies the result of a comparison between two values.
Definition Algorithm.cs:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CompareTo() [3/3]

int IComparable< Quatd >. SystemEx.Numeric.Quatd.CompareTo ( Quatd other)
507 {
508 return (int)CompareTo(other);
509 }

◆ Conjugate()

Quatd SystemEx.Numeric.Quatd.Conjugate ( Quatd v)
static

Computes the quaternion conjugate.

404 {
405 Quatd temp = new Quatd( v);
406
407 temp.m_v.X = -temp.m_v.X;
408 temp.m_v.Y = -temp.m_v.Y;
409 temp.m_v.Z = -temp.m_v.Z;
410
411 return temp;
412 }
Here is the call graph for this function:

◆ DotProduct()

double SystemEx.Numeric.Quatd.DotProduct ( Quatd a,
Quatd b )
static

Computes the DotProduct product of two quaternions.

358 {
359 return a.m_s * b.m_s +
360 a.m_v.X * b.m_v.X +
361 a.m_v.Y * b.m_v.Y +
362 a.m_v.Z * b.m_v.Z;
363 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Equals() [1/2]

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).

Parameters
objThe object to compare with.
Returns
true if obj is a Quatd and equal to this instance; otherwise false.
572 {
573 if ( obj == null ) return false;
574 return (obj is Quatd) && Equals((Quatd)obj);
575 }
Here is the call graph for this function:

◆ Equals() [2/2]

bool SystemEx.Numeric.Quatd.Equals ( Quatd other)

522 {
523 return m_s == other.m_s && m_v == other.m_v;
524 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Exponent()

Quatd SystemEx.Numeric.Quatd.Exponent ( Quatd v)
static

Computes the quaternion exponential.

264 {
265 double Mul;
266
267 Quatd temp = new Quatd( v);
268 double Length = Vec3d.LenghtSqrt(temp.m_v);
269
270 if ( Length > 1.0e-4f )
271 Mul = System.Math.Sin(Length) / Length;
272 else
273 Mul = 1.0;
274
275 temp.m_s = System.Math.Cos(Length);
276
277 temp.m_v.X *= Mul;
278 temp.m_v.Y *= Mul;
279 temp.m_v.Z *= Mul;
280
281 return temp;
282 }
Here is the call graph for this function:

◆ FromAxis()

Quatd SystemEx.Numeric.Quatd.FromAxis ( AxisAngle< Vec3d, double > axisAngle)
static

Creates a quaternion from an axis‑angle representation.

220 {
221
222 double len = Vec3d.LenghtSqrt(axisAngle.Axis);
223 Quatd temp = new Quatd();
224
225 if ( len > 1e-12 ) {
226 double inv = 1.0 / len;
227
228 // Achse normalisieren
229 double nx = axisAngle.Axis.X * inv;
230 double ny = axisAngle.Axis.Y * inv;
231 double nz = axisAngle.Axis.Z * inv;
232
233 double omega = 0.5f * axisAngle.Angle;
234 double s = System.Math.Sin(omega);
235
236 temp.m_v = new Vec3d(s * nx, s * ny, s * nz);
237 temp.m_s = System.Math.Cos(omega);
238 } else {
239 // Ungültige Achse → Identity
240 temp.m_s = 1.0;
241 temp.m_v = Vec3d.Zero;
242 }
243
244 return Normalize(temp);
245
246 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get()

double SystemEx.Numeric.Quatd.Get ( int index)

Gets a component by index .

177 {
178 return index switch
179 {
180 0 => S,
181 1 => X,
182 2 => Y,
183 3 => Z,
184 _ => throw new ArgumentOutOfRangeException(nameof(index))
185 };
186 }
Here is the caller graph for this function:

◆ GetHashCode()

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.

552 {
553 var x = HashFactory.Hash32(this, 674545);
554 if ( x.Value != 0 ) return (int)x.Value;
555
556 return m_v.GetHashCode() ^ m_s.GetHashCode();
557
558 }

◆ GetRotationAngle()

double SystemEx.Numeric.Quatd.GetRotationAngle ( )

Returns the rotation angle represented by this quaternion.

250 {
251 double s = System.Math.Clamp(m_s, -1.0, 1.0);
252 double thetaOver2 = System.Math.Acos(s);
253 return thetaOver2 * 2.0;
254 }
Here is the caller graph for this function:

◆ GetRotationAxis()

Vec3d SystemEx.Numeric.Quatd.GetRotationAxis ( )

Computes the normalized rotation axis of this quaternion.

191 {
192 double sinThetaOver2Sq = 1.0 - m_s * m_s;
193
194 if ( sinThetaOver2Sq <= 0.0 ) {
195 return new Vec3d(1.0, 0.0, 0.0);
196 }
197 double oneOverSinThetaOver2 = 1.0 / System.Math.Sqrt(sinThetaOver2Sq);
198
199 return Vec3d.Normalize(new Vec3d(
200 m_v.X * oneOverSinThetaOver2,
201 m_v.Y * oneOverSinThetaOver2,
202 m_v.Z * oneOverSinThetaOver2
203 ));
204
205 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Invert()

Quatd SystemEx.Numeric.Quatd.Invert ( Quatd q)
static

Computes the inverse of a quaternion.

368 {
369 double temp = Lenght(q);
370 Quatd tq = new Quatd(q);
371
372 tq.m_s /= temp;
373 tq.m_v.X /= -temp;
374 tq.m_v.Y /= -temp;
375 tq.m_v.Z /= -temp;
376 return tq; // Okay, same norm.
377 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsIdentity()

bool SystemEx.Numeric.Quatd.IsIdentity ( Quatd v)
static

Determines whether a quaternion is the identity rotation.

258 {
259 return v.m_v == Vec3d.Zero && System.Math.Abs(v.m_s - 1.0) <= 0.00001f;
260 }
Here is the call graph for this function:

◆ Lenght()

double SystemEx.Numeric.Quatd.Lenght ( Quatd v)
static

Computes the squared length of the quaternion.

321 {
322 return (v.m_s * v.m_s +
323 v.m_v.X * v.m_v.X +
324 v.m_v.Y * v.m_v.Y +
325 v.m_v.Z * v.m_v.Z);
326 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LenghtSqrt()

double SystemEx.Numeric.Quatd.LenghtSqrt ( Quatd v)
static

Computes the Euclidean length of the quaternion.

310 {
311 return System.Math.Sqrt(v.m_s *
312 v.m_s + v.m_v.X *
313 v.m_v.X + v.m_v.Y *
314 v.m_v.Y + v.m_v.Z *
315 v.m_v.Z);
316 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Logarithm()

Quatd SystemEx.Numeric.Quatd.Logarithm ( Quatd v)
static

Computes the quaternion logarithm.

287 {
288
289 Quatd temp = new Quatd( v);
290
291 double vLen = Vec3d.LenghtSqrt(temp.m_v);
292 double angle = System.Math.Atan2(vLen, temp.m_s);
293
294 temp.m_s = 0.0;
295
296 if ( vLen > 1e-6 ) {
297 double scale = angle / vLen;
298 temp.m_v.X *= scale;
299 temp.m_v.Y *= scale;
300 temp.m_v.Z *= scale;
301 } else {
302 temp.m_v = Vec3d.Zero;
303 }
304
305 return temp;
306 }
Here is the call graph for this function:

◆ Normalize()

Quatd SystemEx.Numeric.Quatd.Normalize ( Quatd v)
static

Normalizes a quaternion to unit length.

381 {
382 double norme = LenghtSqrt(v);
383 Quatd temp = new Quatd(v);
384
385 if ( norme < 1e-12f ) {
386 temp.m_s = 1.0;
387 temp.m_v = new Vec3d(0, 0, 0);
388 } else {
389 double recip = 1.0/norme;
390
391 temp.m_s *= recip;
392 temp.m_v.X *= recip;
393 temp.m_v.Y *= recip;
394 temp.m_v.Z *= recip;
395 }
396 return temp;
397 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*() [1/3]

Quatd SystemEx.Numeric.Quatd.operator* ( double a,
Quatd b )
static

Multiplicate a double with a quaternion.

608 {
609 Quatd _ret = new Quatd();
610
611 _ret.m_s = a * b.m_s;
612 _ret.m_v = a * b.m_v;
613
614 return _ret;
615 }
Here is the call graph for this function:

◆ operator*() [2/3]

Quatd SystemEx.Numeric.Quatd.operator* ( Quatd a,
double b )
static

Multiplicate a quaternion with a double.

619 {
620 Quatd _ret = new Quatd();
621
622 _ret.m_s = a.m_s * b;
623 _ret.m_v = a.m_v * b;
624
625 return _ret;
626 }
Here is the call graph for this function:

◆ operator*() [3/3]

Quatd SystemEx.Numeric.Quatd.operator* ( Quatd a,
Quatd b )
static

Multiplies two Quatd component‑wise.

579 {
580 Quatd qtmp = new Quatd();
581
582 double ax = a.m_v.X;
583 double ay = a.m_v.Y;
584 double az = a.m_v.Z;
585
586 double bx = b.m_v.X;
587 double by = b.m_v.Y;
588 double bz = b.m_v.Z;
589
590 double as_ = a.m_s;
591 double bs_ = b.m_s;
592
593 // Skalarteil
594 qtmp.m_s = as_ * bs_ - ax * bx - ay * by - az * bz;
595
596 // Vektorteil
597 qtmp.m_v = new Vec3d(
598 as_ * bx + bs_ * ax + ay * bz - az * by,
599 as_ * by + bs_ * ay + az * bx - ax * bz,
600 as_ * bz + bs_ * az + ax * by - ay * bx
601 );
602
603 return qtmp;
604 }
Here is the call graph for this function:

◆ operator+()

Quatd SystemEx.Numeric.Quatd.operator+ ( Quatd a,
Quatd b )
static

Adds two Quatd component‑wise.

630 {
631 return new Quatd(
632 a.m_s + b.m_s,
633 a.m_v.X + b.m_v.X,
634 a.m_v.Y + b.m_v.Y,
635 a.m_v.Z + b.m_v.Z
636 );
637 }
Here is the call graph for this function:

◆ operator-() [1/2]

Quatd SystemEx.Numeric.Quatd.operator- ( Quatd a)
static

Invert.

652 {
653 return new Quatd(
654 -a.m_s,
655 -a.m_v.X,
656 -a.m_v.Y,
657 -a.m_v.Z
658 );
659 }
Here is the call graph for this function:

◆ operator-() [2/2]

Quatd SystemEx.Numeric.Quatd.operator- ( Quatd a,
Quatd b )
static

Subtracts two Quatd component‑wise.

641 {
642 return new Quatd(
643 a.m_s - b.m_s,
644 a.m_v.X - b.m_v.X,
645 a.m_v.Y - b.m_v.Y,
646 a.m_v.Z - b.m_v.Z
647 );
648 }
Here is the call graph for this function:

◆ operator/() [1/2]

Quatd SystemEx.Numeric.Quatd.operator/ ( Quatd a,
double b )
static

Divides both components of the Quatd by a double.

669 {
670 Quatd _ret = new Quatd();
671
672 _ret.m_s = a.m_s / b;
673 _ret.m_v = a.m_v / b;
674
675 return _ret;
676 }
Here is the call graph for this function:

◆ operator/() [2/2]

Quatd SystemEx.Numeric.Quatd.operator/ ( Quatd a,
Quatd b )
static

Divides two Quatd component‑wise.

663 {
664 return a * Invert(b);
665 }
Here is the call graph for this function:

◆ Power()

Quatd SystemEx.Numeric.Quatd.Power ( Quatd v,
double Exp )
static

Raises a quaternion to a scalar power.

330 {
331 if ( System.Math.Abs(v.m_s) > .9999f ) {
332 return v;
333 }
334
335 // Erhalte halbe angle alpha (alpha = theta/2)
336 double alpha = System.Math.Acos(v.m_s);
337
338 // Berechne neuen alpha Wert
339 double newAlpha = alpha * Exp;
340
341 // Berechne neuen s wert
342 Quatd result = new Quatd();
343 result.m_s = System.Math.Cos(newAlpha);
344
345 // Berechne neue xyz Werte
346
347 double mult = System.Math.Sin(newAlpha) / System.Math.Sin(alpha);
348 result.m_v.X = v.m_v.X * mult;
349 result.m_v.Y = v.m_v.Y * mult;
350 result.m_v.Z = v.m_v.Z * mult;
351
352 return Normalize(result);
353 }
Here is the call graph for this function:

◆ Slerp()

Quatd SystemEx.Numeric.Quatd.Slerp ( Quatd q0,
Quatd q1,
double t )
static

Performs spherical linear interpolation between two quaternions.

417 { // Spherical linear interpolation.
418 if ( t <= 0.0 ) return q0;
419 if ( t >= 1.0 ) return q1;
420
421 double cosOmega = DotProduct(q0, q1);
422
423 double q1w = q1.m_s;
424 double q1x = q1.m_v.X;
425 double q1y = q1.m_v.Y;
426 double q1z = q1.m_v.Z;
427
428 if ( cosOmega < 0.0 ) {
429 q1w = -q1w;
430 q1x = -q1x;
431 q1y = -q1y;
432 q1z = -q1z;
433 cosOmega = -cosOmega;
434 }
435
436 Debug.Assert(cosOmega < 1.0);
437
438 // Compute interpolation fraction, checking for quaternions
439 // almost exactly the same
440
441 double k0, k1;
442 if ( cosOmega > 0.9999 ) {
443 k0 = 1.0 - t;
444 k1 = t;
445 } else {
446 // Compute the sin of the angle using the
447 // trig identity sin^2(omega) + cos^2(omega) = 1
448
449 double sinOmega = System.Math.Sqrt(1.0 - cosOmega*cosOmega);
450
451 // Compute the angle from its sin and cosine
452
453 double omega = System.Math.Atan2(sinOmega, cosOmega);
454
455 // Compute inverse of denominator, so we only have
456 // to divide once
457
458 double oneOverSinOmega = 1.0 / sinOmega;
459
460 // Compute interpolation parameters
461
462 k0 = System.Math.Sin((1.0 - t) * omega) * oneOverSinOmega;
463 k1 = System.Math.Sin(t * omega) * oneOverSinOmega;
464 }
465
466 // Interpolate
467
468 Quatd result = new Quatd();
469
470 result.m_v.X = k0 * q0.m_v.X + k1 * q1x;
471 result.m_v.Y = k0 * q0.m_v.Y + k1 * q1y;
472 result.m_v.Z = k0 * q0.m_v.Z + k1 * q1z;
473 result.m_s = k0 * q0.m_s + k1 * q1w;
474
475 // Return it
476
477 return result;
478 }
Here is the call graph for this function:

◆ ToAxisAngle()

AxisAngle< Vec3d, double > SystemEx.Numeric.Quatd.ToAxisAngle ( Quatd q)
static

Converts a quaternion into an axis‑angle representation.

209 {
210 AxisAngle<Vec3d, double> _ret = new AxisAngle<Vec3d, double>();
211
212 _ret.Angle = q.GetRotationAngle();
213 _ret.Axis = q.GetRotationAxis();
214
215 return _ret;
216 }
Here is the call graph for this function:

◆ ToBytes()

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 >.

534 {
535 Cache m = new Cache(sizeof(double) * 4);
536
537 for ( byte i = 0 ; i < 4 ; i++ )
538 m.WriteRange((ulong)(sizeof(double) * i), Get(i).ToBytes());
539
540 return m.ToArrayEx();
541 }
FixedVector< byte > ToArrayEx()
Returns a copy of the internal buffer, as Array<T>.
Definition Cache.cs:656
virtual ulong WriteRange(ulong position, byte[] data)
Writes a byte range into the cache starting at the specified position.
Definition Cache.cs:231
Here is the call graph for this function:
Here is the caller graph for this function:

Property Documentation

◆ AxisAngle

AxisAngle<Vec3d, double> SystemEx.Numeric.Quatd.AxisAngle
get

Gets the axis‑angle representation of this quaternion.

◆ CompareMode

CompareType SystemEx.Numeric.Quatd.CompareMode
getset

Gets or sets the comparison mode used by CompareTo(Quatd).

105{ get => m_comparebleMode; set => m_comparebleMode = value; }

◆ S

double SystemEx.Numeric.Quatd.S
getset

Gets or sets the scalar component (w) of the quaternion.

70{ get => m_s; set => m_s = value; }

◆ V

Vec3d SystemEx.Numeric.Quatd.V
getset

Gets or sets the vector component (x,y,z) of the quaternion.

75{ get => m_v; set => m_v = value; }

◆ X

double SystemEx.Numeric.Quatd.X
getset

Gets or sets the X component of the quaternion's vector part.

80{ get => m_v.X; set => m_v.X = value; }

◆ Y

double SystemEx.Numeric.Quatd.Y
getset

Gets or sets the Y component of the quaternion's vector part.

85{ get => m_v.Y; set => m_v.Y = value; }

◆ Z

double SystemEx.Numeric.Quatd.Z
getset

Gets or sets the Z component of the quaternion's vector part.

90{ get => m_v.Z; set => m_v.Z = value; }

The documentation for this struct was generated from the following file:
  • Quatd.cs