C4 Engine
C4 Engine API Documentation

class Motor3D

Defined in:  TSMotor3D.h
The Motor3D class encapsulates a 3D motion operator (motor), also known as a dual quaternion. For more information about motors, see the projective geometric algebra website.
Definition

class Motor3D

Member Functions
Motor3D::Set Sets all eight components of a motor.
Motor3D::Unitize Unitizes the weight of a motor.
Motor3D::MakeRotation Returns a motor that represents a rotation about a given axis through the origin.
Motor3D::MakeTranslation Returns a motor that represents a translation.
Motor3D::MakeScrew Returns a motor that represents a general screw motion.
Motor3D::GetDirectionX Returns the direction to which the x axis is transformed by a motor.
Motor3D::GetDirectionY Returns the direction to which the y axis is transformed by a motor.
Motor3D::GetDirectionZ Returns the direction to which the z axis is transformed by a motor.
Motor3D::GetPosition Returns the position to which the origin is transformed by a motor.
Motor3D::GetTransformMatrix Converts a motor to its corresponding 4 × 4 matrix.
Motor3D::GetInverseTransformMatrix Converts a motor to the inverse of its corresponding 4 × 4 matrix.
Motor3D::GetTransformMatrices Converts a motor to its corresponding 4 × 4 matrix and its inverse simultaneously.
Motor3D::SetTransformMatrix Converts a 4 × 4 matrix to its corresponding motor.
Constructor

Motor3D();

Motor3D(float vx, float vy, float vz, float vw, float mx, float my, float mz, float mw);

Motor3D(const Quaternion& rotor);

Motor3D(const Quaternion& rotor, const Quaternion& screw);

Motor3D(const Plane3D& g, const Plane3D& h);

Motor3D(const Line3D& k, const Line3D& l);

Motor3D(const Point3D& p, const Point3D& q);

Parameters
vx,vy,vz,vw The values of the e41, e42, e43, and antiscalar coordinates.
mx,my,mz,mw The values of the e23, e31, e12, and scalar coordinates.
rotor A quaternion whose entries are copied to the e41, e42, e43, and antiscalar coordinates.
screw A quaternion whose entries are copied to the e23, e31, e12, and scalar coordinates.
g,h Two 4D trivectors representing planes.
k,l Two 4D bivectors representing lines.
p,q Two 3D points.
Description
The Motor3D class encapsulates a motion operator (motor) in the 4D projective geometric algebra. It has the general form Qvxe41 + Qvye42 + Qvze43 + Qvw𝟙 + Qmxe23 + Qmye31 + Qmze12 + Qmw.

The default constructor leaves the components of the motor undefined. If the quaternions rotor and screw are specified, then their coordinates are assigned to the weight and bulk of the motor, respectively. If only the quaternion rotor is specified, then the bulk of the motor is set to zero.

If the g and h parameters are specified, then the motor is set to the geometric antiproduct h ⟇ g, corresponding to the rotation about the line where the planes g and h intersect by twice the angle between them in the direction from g to h.

If the k and l parameters are specified, then the motor is set to the geometric antiproduct l ⟇ k, corresponding to the rotation about the line containing the closest points on the lines k and l by twice the angle between their directions and the translation by twice the distance between the lines in the direction from k to l.

If the p and q parameters are specified, then the motor is set to the geometric antiproduct q ⟇ p, corresponding to the translation by twice the distance between the points p and q in the direction from p to q.
Overloaded Operators
Motor3D& operator +=(const Motor3D& Q); Adds the motor Q.
Motor3D& operator -=(const Motor3D& Q); Subtracts the motor Q.
Motor3D& operator *=(float n); Multiplies by the scalar n.
Motor3D& operator /=(float n); Multiplies by the inverse of the scalar n.
Nonmember Operations
bool operator ==(const Motor3D& a, const Motor3D& b); Returns a boolean value indicating whether the two motors a and b are equal.
bool operator !=(const Motor3D& a, const Motor3D& b); Returns a boolean value indicating whether the two motors a and b are not equal.
Motor3D operator ~(const Motor3D& Q); Returns the antireverse of the motor Q.
Motor3D operator -(const Motor3D& Q); Returns the negation of the motor Q.
Motor3D operator +(const Motor3D& a, const Motor3D& b) const; Returns the sum of the motors a and b.
Motor3D operator -(const Motor3D& a, const Motor3D& b) const; Returns the difference of the motors a and b.
Motor3D operator *(const Motor3D& Q, float n); Returns the product of the motor Q and the scalar n.
Motor3D operator *(float n, const Motor3D& Q); Returns the product of the motor Q and the scalar n.
Motor3D operator /(const Motor3D& Q, float n); Returns the product of the motor Q and the inverse of the scalar n.
Motor3D operator *(const Motor3D& a, const Motor3D& b); Returns the geometric antiproduct of the motors a and b.
Motor3D operator *(const Motor3D& Q, const Quaternion& r); Returns the geometric antiproduct of the motor Q and the quaternion r.
Motor3D operator *(const Quaternion& r, const Motor3D& Q); Returns the geometric antiproduct of the quaternion r and the motor Q.
float BulkNorm(const Motor3D& Q); Returns the bulk norm of the motor Q.
float WeightNorm(const Motor3D& Q); Returns the weight norm of the motor Q.
Motor3D Sqrt(const Motor3D& Q); Returns the square root of the motor Q with respect to the geometric antiproduct.
Vector3D Transform(const Vector3D& v, const Motor3D& Q); Transforms the vector v with the motor Q.
Bivector3D Transform(const Bivector3D& v, const Motor3D& Q); Transforms the bivector v with the motor Q.
Point3D Transform(const Point3D& p, const Motor3D& Q); Transforms the point p with the motor Q.
Line3D Transform(const Line3D& l, const Motor3D& Q); Transforms the line l with the motor Q.
Plane3D Transform(const Plane3D& g, const Motor3D& Q); Transforms the plane g with the motor Q.
See Also

Flector3D

Quaternion

Point3D

Line3D

Plane3D