 C4 Engine API Documentation

## class Motor4D

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

`class Motor4D`

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

`Motor4D();`

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

`Motor4D(const Quaternion& rotor);`

`Motor4D(const Quaternion& rotor, const Quaternion& screw);`

`Motor4D(const Plane3D& g, const Plane3D& h);`

`Motor4D(const Line3D& k, const Line3D& l);`

`Motor4D(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 `Motor4D` 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`.
 `Motor4D& operator +=(const Motor4D& Q);` Adds the motor `Q`. `Motor4D& operator -=(const Motor4D& Q);` Subtracts the motor `Q`. `Motor4D& operator *=(float n);` Multiplies by the scalar `n`. `Motor4D& operator /=(float n);` Multiplies by the inverse of the scalar `n`.
Nonmember Operations
 `bool operator ==(const Motor4D& a, const Motor4D& b);` Returns a boolean value indicating whether the two motors `a` and `b` are equal. `bool operator !=(const Motor4D& a, const Motor4D& b);` Returns a boolean value indicating whether the two motors `a` and `b` are not equal. `Motor4D operator ~(const Motor4D& Q);` Returns the antireverse of the motor `Q`. `Motor4D operator -(const Motor4D& Q);` Returns the negation of the motor `Q`. `Motor4D operator +(const Motor4D& a, const Motor4D& b) const;` Returns the sum of the motors `a` and `b`. `Motor4D operator -(const Motor4D& a, const Motor4D& b) const;` Returns the difference of the motors `a` and `b`. `Motor4D operator *(const Motor4D& Q, float n);` Returns the product of the motor `Q` and the scalar `n`. `Motor4D operator *(float n, const Motor4D& Q);` Returns the product of the motor `Q` and the scalar `n`. `Motor4D operator /(const Motor4D& Q, float n);` Returns the product of the motor `Q` and the inverse of the scalar `n`. `Motor4D operator *(const Motor4D& a, const Motor4D& b);` Returns the geometric antiproduct of the motors `a` and `b`. `Motor4D operator *(const Motor4D& Q, const Quaternion& r);` Returns the geometric antiproduct of the motor `Q` and the quaternion `r`. `Motor4D operator *(const Quaternion& r, const Motor4D& Q);` Returns the geometric antiproduct of the quaternion `r` and the motor `Q`. `float BulkNorm(const Motor4D& Q);` Returns the bulk norm of the motor `Q`. `float WeightNorm(const Motor4D& Q);` Returns the weight norm of the motor `Q`. `Motor4D Sqrt(const Motor4D& Q);` Returns the square root of the motor `Q` with respect to the geometric antiproduct. `Vector3D Transform(const Vector3D& v, const Motor4D& Q);` Transforms the vector `v` with the motor `Q`. `Bivector3D Transform(const Bivector3D& v, const Motor4D& Q);` Transforms the bivector `v` with the motor `Q`. `Point3D Transform(const Point3D& p, const Motor4D& Q);` Transforms the point `p` with the motor `Q`. `Line3D Transform(const Line3D& l, const Motor4D& Q);` Transforms the line `l` with the motor `Q`. `Plane3D Transform(const Plane3D& g, const Motor4D& Q);` Transforms the plane `g` with the motor `Q`.
`Flector4D`
`Quaternion`
`Point3D`
`Line3D`
`Plane3D`