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

Dual quaternion using single-precision floating point values. Represents a rigid 3D transformation consisting of rotation (real part) and translation (dual part). Provides stable, non-drifting transformations compared to matrix-based approaches. More...

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

Public Member Functions

 DQuatf (Quatf rotation)
 Creates a dual quaternion with rotation only. Translation is initialized to zero.
 DQuatf (Quatf rotation, Vec3f translation)
 Creates a dual quaternion from rotation and translation.
void Normalize ()
 Normalizes both rotation and dual components. Required for stable interpolation and accumulation.
void Rotation (Quatf rotation)
 Sets the rotation component of the dual quaternion.
void Translation (Vec3f translation)
 Sets the translation component of the dual quaternion. Translation is encoded into the dual part using: qd = 0.5 * (translation_quat * rotation).
void RotationTranslation (Quatf rotation, Vec3f translation)
 Sets both rotation and translation components. Translation is encoded into the dual part.
DQuatf Invert ()
 Computes the inverse of the dual quaternion. Inverts rotation and adjusts translation accordingly.
Vec3f Transform (Vec3f v)
 Transforms a vector using the dual quaternion. Applies rotation and translation without matrix drift.

Static Public Member Functions

static DQuatf Slerp (DQuatf a, DQuatf b, float t)
 Performs screw-motion interpolation between two dual quaternions. Interpolates rotation and translation simultaneously.
static DQuatf operator* (DQuatf a, DQuatf b)
 Multiplies two dual quaternions, combining their transformations.
static DQuatf operator+ (DQuatf a, DQuatf b)
 Linear addition of dual quaternions. Not a valid rigid transformation; used for blending only.
static DQuatf operator- (DQuatf a, DQuatf b)
 Linear subtraction of dual quaternions. Not a valid rigid transformation; used for blending only.
static DQuatf operator/ (DQuatf a, float s)
 Divides both components by a scalar. Useful for normalization and weighted blending.
static DQuatf FromRotationTranslation (Quatf rotation, Vec3f translation)
 Creates a dual quaternion from rotation and translation. Translation is encoded into the dual part using: qd = 0.5 * (translation_quat * rotation).
static DQuatf FromRotationTranslationConjugated (Quatf rotation, Vec3f translation)
 Creates a dual quaternion using the conjugated rotation. Useful for inverse transformation chains.

Public Attributes

Quatf m_rot
 Rotation component (real part).
Quatf m_translation
 Translation component (dual part).

Properties

Quatf Real [get]
 Gets the rotation component of the dual quaternion.
Quatf Dual [get]
 Gets the translation component of the dual quaternion.

Detailed Description

Dual quaternion using single-precision floating point values. Represents a rigid 3D transformation consisting of rotation (real part) and translation (dual part). Provides stable, non-drifting transformations compared to matrix-based approaches.

Constructor & Destructor Documentation

◆ DQuatf() [1/2]

SystemEx.Numeric.DQuatf.DQuatf ( Quatf rotation)

Creates a dual quaternion with rotation only. Translation is initialized to zero.

85 {
86 m_rot = rotation;
87 m_translation = new Quatf(0f, 0f, 0f, 0f);
88 }
Here is the caller graph for this function:

◆ DQuatf() [2/2]

SystemEx.Numeric.DQuatf.DQuatf ( Quatf rotation,
Vec3f translation )

Creates a dual quaternion from rotation and translation.

94 {
95 var x = FromRotationTranslation(rotation, translation);
96 m_rot = x.m_rot;
97 m_translation = x.m_translation;
98 }
Here is the call graph for this function:

Member Function Documentation

◆ FromRotationTranslation()

DQuatf SystemEx.Numeric.DQuatf.FromRotationTranslation ( Quatf rotation,
Vec3f translation )
static

Creates a dual quaternion from rotation and translation. Translation is encoded into the dual part using: qd = 0.5 * (translation_quat * rotation).

246 {
247 Quatf real = rotation;
248 Quatf t = new Quatf(0f, translation.X, translation.Y, translation.Z);
249 Quatf dual = 0.5f * (t * rotation);
250
251 return new DQuatf
252 {
253 m_rot = real,
254 m_translation = dual
255 };
256 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FromRotationTranslationConjugated()

DQuatf SystemEx.Numeric.DQuatf.FromRotationTranslationConjugated ( Quatf rotation,
Vec3f translation )
static

Creates a dual quaternion using the conjugated rotation. Useful for inverse transformation chains.

263 {
264 Quatf r = Quatf.Conjugate(rotation);
265 Quatf t = new Quatf(0f, translation.X, translation.Y, translation.Z);
266 Quatf dual = 0.5f * (t * r);
267
268 return new DQuatf
269 {
270 m_rot = r,
271 m_translation = dual
272 };
273 }
Here is the call graph for this function:

◆ Invert()

DQuatf SystemEx.Numeric.DQuatf.Invert ( )

Computes the inverse of the dual quaternion. Inverts rotation and adjusts translation accordingly.

146 {
147 Quatf rInv = Quatf.Invert(m_rot);
148 Quatf dInv = -(rInv * m_translation * rInv);
149
150 return new DQuatf
151 {
152 m_rot = rInv,
153 m_translation = dInv
154 };
155 }
Here is the call graph for this function:

◆ Normalize()

void SystemEx.Numeric.DQuatf.Normalize ( )

Normalizes both rotation and dual components. Required for stable interpolation and accumulation.

105 {
106 float len = Quatf.Lenght(m_rot);
107 m_rot /= len;
108 m_translation /= len;
109 }
Here is the call graph for this function:

◆ operator*()

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

Multiplies two dual quaternions, combining their transformations.

194 {
195 Quatf real = a.m_rot * b.m_rot;
196 Quatf dual = a.m_rot * b.m_translation + a.m_translation * b.m_rot;
197
198 DQuatf result;
199 result.m_rot = real;
200 result.m_translation = dual;
201 return result;
202 }
Here is the call graph for this function:

◆ operator+()

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

Linear addition of dual quaternions. Not a valid rigid transformation; used for blending only.

208 {
209 return new DQuatf
210 {
211 m_rot = a.m_rot + b.m_rot,
212 m_translation = a.m_translation + b.m_translation
213 };
214 }
Here is the call graph for this function:

◆ operator-()

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

Linear subtraction of dual quaternions. Not a valid rigid transformation; used for blending only.

221 {
222 return new DQuatf
223 {
224 m_rot = a.m_rot - b.m_rot,
225 m_translation = a.m_translation - b.m_translation
226 };
227 }
Here is the call graph for this function:

◆ operator/()

DQuatf SystemEx.Numeric.DQuatf.operator/ ( DQuatf a,
float s )
static

Divides both components by a scalar. Useful for normalization and weighted blending.

233 {
234 return new DQuatf
235 {
236 m_rot = a.m_rot / s,
237 m_translation = a.m_translation / s
238 };
239 }
Here is the call graph for this function:

◆ Rotation()

void SystemEx.Numeric.DQuatf.Rotation ( Quatf rotation)

Sets the rotation component of the dual quaternion.

115 {
116 m_rot = rotation;
117 }

◆ RotationTranslation()

void SystemEx.Numeric.DQuatf.RotationTranslation ( Quatf rotation,
Vec3f translation )

Sets both rotation and translation components. Translation is encoded into the dual part.

135 {
136 m_rot = rotation;
137 Quatf t = new Quatf(0f, translation.X, translation.Y, translation.Z);
138 m_translation = 0.5f * (t * rotation);
139 }

◆ Slerp()

DQuatf SystemEx.Numeric.DQuatf.Slerp ( DQuatf a,
DQuatf b,
float t )
static

Performs screw-motion interpolation between two dual quaternions. Interpolates rotation and translation simultaneously.

179 {
180 Quatf rot = Quatf.Slerp(a.m_rot, b.m_rot, t);
181 Quatf dual = Quatf.Slerp(a.m_translation, b.m_translation, t);
182
183 return new DQuatf
184 {
185 m_rot = rot,
186 m_translation = dual
187 };
188 }
Here is the call graph for this function:

◆ Transform()

Vec3f SystemEx.Numeric.DQuatf.Transform ( Vec3f v)

Transforms a vector using the dual quaternion. Applies rotation and translation without matrix drift.

163 {
164 Quatf p = new Quatf(0f, v.X, v.Y, v.Z);
165 Quatf rInv = Quatf.Invert(m_rot);
166 Quatf rotated = m_rot * p * rInv;
167
168 Quatf trans = m_translation * rInv;
169 Vec3f t = new Vec3f(trans.X, trans.Y, trans.Z) * 2f;
170
171 return new Vec3f(rotated.X, rotated.Y, rotated.Z) + t;
172 }
Here is the call graph for this function:

◆ Translation()

void SystemEx.Numeric.DQuatf.Translation ( Vec3f translation)

Sets the translation component of the dual quaternion. Translation is encoded into the dual part using: qd = 0.5 * (translation_quat * rotation).

125 {
126 Quatf t = new Quatf(0f, translation.X, translation.Y, translation.Z);
127 m_translation = 0.5f * (t * m_rot);
128 }

Member Data Documentation

◆ m_rot

Quatf SystemEx.Numeric.DQuatf.m_rot

Rotation component (real part).

◆ m_translation

Quatf SystemEx.Numeric.DQuatf.m_translation

Translation component (dual part).

Property Documentation

◆ Dual

Quatf SystemEx.Numeric.DQuatf.Dual
get

Gets the translation component of the dual quaternion.

◆ Real

Quatf SystemEx.Numeric.DQuatf.Real
get

Gets the rotation component of the dual quaternion.


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