Rotor
group rotor
The rotor is an entity that represents a rigid rotation about an axis. To apply the rotor to a supported entity, the call operator is available.
Example
// Initialize a point at (1, 3, 2)
kln::point p{1.f, 3.f, 2.f};
// Create a normalized rotor representing a pi/2 radian
// rotation about the xz-axis.
kln::rotor r{M_PI * 0.5f, 1.f, 0.f, 1.f};
// Rotate our point using the created rotor
kln::point rotated = r(p);
Rotors can be multiplied to one another with the *
operator to create a new rotor equivalent to the application of each factor.
Example
// Create a normalized rotor representing a $\frac{\pi}{2}$ radian
// rotation about the xz-axis.
kln::rotor r1{M_PI * 0.5f, 1.f, 0.f, 1.f};
// Create a second rotor representing a $\frac{\pi}{3}$ radian
// rotation about the yz-axis.
kln::rotor r2{M_PI / 3.f, 0.f, 1.f, 1.f};
// Use the geometric product to create a rotor equivalent to first
// applying r1, then applying r2. Note that the order of the
// operands here is significant.
kln::rotor r3 = r2 * r1;
The same *
operator can be used to compose the rotor's action with other translators and motors.
Summary
Members | Descriptions |
---|---|
public rotor () = default |
|
public rotor (float ang_rad,float x,float y,float z) noexcept |
Convenience constructor. Computes transcendentals and normalizes rotation axis. |
public rotor (__m128 p1) noexcept |
|
public void load_normalized (float * data) noexcept |
Fast load operation for packed data that is already normalized. The argument data should point to a set of 4 float values with layout (a, b, c, d) corresponding to the multivector \(a + b\mathbf{e}_{23} + c\mathbf{e}_{31} + d\mathbf{e}_{12}\). |
public void normalize () noexcept |
Normalize a rotor such that \(\mathbf{r}\widetilde{\mathbf{r}} = 1\). |
public rotor normalized () const noexcept |
Return a normalized copy of this rotor. |
public void invert () noexcept |
|
public rotor inverse () const noexcept |
|
public void constrain () noexcept |
Constrains the rotor to traverse the shortest arc. |
public rotor constrained () const noexcept |
|
public bool KLN_VEC_CALL operator== (rotor other) const noexcept |
|
public bool KLN_VEC_CALL approx_eq (rotor other,float epsilon) const noexcept |
|
public mat3x4 as_mat3x4 () const noexcept |
Converts the rotor to a 3x4 column-major matrix. The results of this conversion are only defined if the rotor is normalized, and this conversion is preferable if so. |
public mat4x4 as_mat4x4 () const noexcept |
Converts the rotor to a 4x4 column-major matrix. |
public plane KLN_VEC_CALL operator() (plane const & p) const noexcept |
Conjugates a plane \(p\) with this rotor and returns the result \(rp\widetilde{r}\). |
public void KLN_VEC_CALL operator() (plane * in,plane * out,size_t count) const noexcept |
Conjugates an array of planes with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out (in place motor application). |
public branch KLN_VEC_CALL operator() (branch const & b) const noexcept |
|
public line KLN_VEC_CALL operator() (line const & l) const noexcept |
Conjugates a line \(\ell\) with this rotor and returns the result \(r\ell \widetilde{r}\). |
public void KLN_VEC_CALL operator() (line * in,line * out,size_t count) const noexcept |
Conjugates an array of lines with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out (in place rotor application). |
public point KLN_VEC_CALL operator() (point const & p) const noexcept |
Conjugates a point \(p\) with this rotor and returns the result \(rp\widetilde{r}\). |
public void KLN_VEC_CALL operator() (point * in,point * out,size_t count) const noexcept |
Conjugates an array of points with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out (in place rotor application). |
public direction KLN_VEC_CALL operator() (direction const & d) const noexcept |
Conjugates a direction \(d\) with this rotor and returns the result \(rd\widetilde{r}\). |
public void KLN_VEC_CALL operator() (direction * in,direction * out,size_t count) const noexcept |
Conjugates an array of directions with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out (in place rotor application). |
public rotor &KLN_VEC_CALL operator+= (rotor b) noexcept |
Rotor addition. |
public rotor &KLN_VEC_CALL operator-= (rotor b) noexcept |
Rotor subtraction. |
public rotor & operator*= (float s) noexcept |
Rotor uniform scale. |
public rotor & operator*= (int s) noexcept |
Rotor uniform scale. |
public rotor & operator/= (float s) noexcept |
Rotor uniform inverse scale. |
public rotor & operator/= (int s) noexcept |
Rotor uniform inverse scale. |
public float scalar () const noexcept |
|
public float e12 () const noexcept |
|
public float e21 () const noexcept |
|
public float e31 () const noexcept |
|
public float e13 () const noexcept |
|
public float e23 () const noexcept |
|
public float e32 () const noexcept |
|
public rotor KLN_VEC_CALL operator+ (rotor a,rotor b) noexcept |
Rotor addition. |
public rotor KLN_VEC_CALL operator- (rotor a,rotor b) noexcept |
Rotor subtraction. |
public rotor KLN_VEC_CALL operator* (rotor r,float s) noexcept |
Rotor uniform scale. |
public rotor KLN_VEC_CALL operator* (rotor r,int s) noexcept |
Rotor uniform scale. |
public rotor KLN_VEC_CALL operator* (float s,rotor r) noexcept |
Rotor uniform scale. |
public rotor KLN_VEC_CALL operator* (int s,rotor r) noexcept |
Rotor uniform scale. |
public rotor KLN_VEC_CALL operator/ (rotor r,float s) noexcept |
Rotor uniform inverse scale. |
public rotor KLN_VEC_CALL operator/ (rotor r,int s) noexcept |
Rotor uniform inverse scale. |
public rotor KLN_VEC_CALL operator~ (rotor r) noexcept |
Reversion operator. |
public rotor KLN_VEC_CALL operator- (rotor r) noexcept |
Unary minus. |
Members
rotor() = default
rotor(float ang_rad,float x,float y,float z) noexcept
Convenience constructor. Computes transcendentals and normalizes rotation axis.
rotor(__m128 p1) noexcept
void load_normalized(float * data) noexcept
Fast load operation for packed data that is already normalized. The argument data
should point to a set of 4 float values with layout (a, b, c, d)
corresponding to the multivector \(a + b\mathbf{e}_{23} + c\mathbf{e}_{31} + d\mathbf{e}_{12}\).
Danger
The rotor data loaded this way must be normalized. That is, the rotor \(r\) must satisfy \(r\widetilde{r} = 1\).
void normalize() noexcept
Normalize a rotor such that \(\mathbf{r}\widetilde{\mathbf{r}} = 1\).
rotor normalized() const noexcept
Return a normalized copy of this rotor.
void invert() noexcept
rotor inverse() const noexcept
void constrain() noexcept
Constrains the rotor to traverse the shortest arc.
rotor constrained() const noexcept
bool KLN_VEC_CALL operator==(rotor other) const noexcept
bool KLN_VEC_CALL approx_eq(rotor other,float epsilon) const noexcept
mat3x4 as_mat3x4() const noexcept
Converts the rotor to a 3x4 column-major matrix. The results of this conversion are only defined if the rotor is normalized, and this conversion is preferable if so.
mat4x4 as_mat4x4() const noexcept
Converts the rotor to a 4x4 column-major matrix.
plane KLN_VEC_CALL operator()(plane const & p) const noexcept
Conjugates a plane \(p\) with this rotor and returns the result \(rp\widetilde{r}\).
void KLN_VEC_CALL operator()(plane * in,plane * out,size_t count) const noexcept
Conjugates an array of planes with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out
(in place motor application).
Tip
When applying a rotor to a list of tightly packed planes, this routine will be significantly faster than applying the rotor to each plane individually.
branch KLN_VEC_CALL operator()(branch const & b) const noexcept
line KLN_VEC_CALL operator()(line const & l) const noexcept
Conjugates a line \(\ell\) with this rotor and returns the result \(r\ell \widetilde{r}\).
void KLN_VEC_CALL operator()(line * in,line * out,size_t count) const noexcept
Conjugates an array of lines with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out
(in place rotor application).
Tip
When applying a rotor to a list of tightly packed lines, this routine will be significantly faster than applying the rotor to each line individually.
point KLN_VEC_CALL operator()(point const & p) const noexcept
Conjugates a point \(p\) with this rotor and returns the result \(rp\widetilde{r}\).
void KLN_VEC_CALL operator()(point * in,point * out,size_t count) const noexcept
Conjugates an array of points with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out
(in place rotor application).
Tip
When applying a rotor to a list of tightly packed points, this routine will be significantly faster than applying the rotor to each point individually.
direction KLN_VEC_CALL operator()(direction const & d) const noexcept
Conjugates a direction \(d\) with this rotor and returns the result \(rd\widetilde{r}\).
void KLN_VEC_CALL operator()(direction * in,direction * out,size_t count) const noexcept
Conjugates an array of directions with this rotor in the input array and stores the result in the output array. Aliasing is only permitted when in == out
(in place rotor application).
Tip
When applying a rotor to a list of tightly packed directions, this routine will be significantly faster than applying the rotor to each direction individually.
rotor &KLN_VEC_CALL operator+=(rotor b) noexcept
Rotor addition.
rotor &KLN_VEC_CALL operator-=(rotor b) noexcept
Rotor subtraction.
rotor & operator*=(float s) noexcept
Rotor uniform scale.
rotor & operator*=(int s) noexcept
Rotor uniform scale.
rotor & operator/=(float s) noexcept
Rotor uniform inverse scale.
rotor & operator/=(int s) noexcept
Rotor uniform inverse scale.
float scalar() const noexcept
float e12() const noexcept
float e21() const noexcept
float e31() const noexcept
float e13() const noexcept
float e23() const noexcept
float e32() const noexcept
rotor KLN_VEC_CALL operator+(rotor a,rotor b) noexcept
Rotor addition.
rotor KLN_VEC_CALL operator-(rotor a,rotor b) noexcept
Rotor subtraction.
rotor KLN_VEC_CALL operator*(rotor r,float s) noexcept
Rotor uniform scale.
rotor KLN_VEC_CALL operator*(rotor r,int s) noexcept
Rotor uniform scale.
rotor KLN_VEC_CALL operator*(float s,rotor r) noexcept
Rotor uniform scale.
rotor KLN_VEC_CALL operator*(int s,rotor r) noexcept
Rotor uniform scale.
rotor KLN_VEC_CALL operator/(rotor r,float s) noexcept
Rotor uniform inverse scale.
rotor KLN_VEC_CALL operator/(rotor r,int s) noexcept
Rotor uniform inverse scale.
rotor KLN_VEC_CALL operator~(rotor r) noexcept
Reversion operator.
rotor KLN_VEC_CALL operator-(rotor r) noexcept
Unary minus.