You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 2, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/api/kln::direction.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,25 +5,33 @@ struct kln::direction
5
5
: public kln::entity< 0b1000 >
6
6
```
7
7
8
+
Directions in $\mathbf{P}(\mathbb{R}^3_{3, 0, 1})$ are represented using points at infinity (homogeneous coordinate 0). Having a homogeneous coordinate of zero ensures that directions are translation-invariant.
`public void `[`normalize`](#structkln_1_1direction_1a143cd2cfeb94860ce1d47b9735064802)`() noexcept` | Normalize this direction by dividing all components by the square magnitude
Copy file name to clipboardExpand all lines: docs/api/kln::motor.md
+55Lines changed: 55 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,42 @@ struct kln::motor
7
7
8
8
A `motor` represents a kinematic motion in our algebra. From [Chasles' theorem](https://en.wikipedia.org/wiki/Chasles%27_theorem_(kinematics)), we know that any rigid body displacement can be produced by a translation along a line, followed or preceded by a rotation about an axis parallel to that line. The motor algebra is isomorphic to the dual quaternions but exists here in the same algebra as all the other geometric entities and actions at our disposal. Operations such as composing a motor with a rotor or translator are possible for example. The primary benefit to using a motor over its corresponding matrix operation is twofold. First, you get the benefit of numerical stability when composing multiple actions via the geometric product (`*` ). Second, because the motors constitute a continuous group, they are amenable to smooth interpolation and differentiation.
9
9
10
+
!!! example
11
+
```c++
12
+
// Create a rotor representing a pi/2 rotation about the z-axis
13
+
// Normalization is done automatically
14
+
rotor r{M_PI * 0.5f, 0.f, 0.f, 1.f};
15
+
16
+
// Create a translator that represents a translation of 1 unit
17
+
// in the yz-direction. Normalization is done automatically.
18
+
translator t{1.f, 0.f, 1.f, 1.f};
19
+
20
+
// Create a motor that combines the action of the rotation and
21
+
// translation above.
22
+
motor m = r * t;
23
+
24
+
// Initialize a point at (1, 3, 2)
25
+
kln::point p1{1.f, 3.f, 2.f};
26
+
27
+
// Translate p1 and rotate it to create a new point p2
28
+
kln::point p2 = m(p1);
29
+
```
30
+
31
+
32
+
Motors can be multiplied to one another with the `*` operator to create a new motor equivalent to the application of each factor.
33
+
34
+
!!! example
35
+
```c++
36
+
// Suppose we have 3 motors m1, m2, and m3
37
+
38
+
// The motor m created here represents the combined action of m1,
39
+
// m2, and m3.
40
+
kln::motor m = m3 * m2 * m1;
41
+
```
42
+
43
+
44
+
The same `*` operator can be used to compose the motor's action with other translators and rotors.
45
+
10
46
A demonstration of using the exponential and logarithmic map to blend between two motors is provided in a test case [here](https://github.com/jeremyong/Klein/blob/master/test/test_exp_log.cpp#L48).
11
47
12
48
### Summary
@@ -27,6 +63,8 @@ A demonstration of using the exponential and logarithmic map to blend between tw
27
63
`public `[`point`](/Klein/api/kln::point#structkln_1_1point)` KLN_VEC_CALL `[`operator()`](#structkln_1_1motor_1a7ae8d73c558d1f6581df3a4b50fb2a40)`(`[`point`](/Klein/api/kln::point#structkln_1_1point)` const & p) const noexcept` | Conjugates a point $p$ with this motor and returns the result $mp\widetilde{m}$.
28
64
`public void KLN_VEC_CALL `[`operator()`](#structkln_1_1motor_1ab14cf440bf8281b4a56cc338c568156b)`(`[`point`](/Klein/api/kln::point#structkln_1_1point)` * in,`[`point`](/Klein/api/kln::point#structkln_1_1point)` * out,size_t count) const noexcept` | Conjugates an array of points with this motor in the input array and stores the result in the output array. Aliasing is only permitted when `in == out` (in place motor application).
29
65
`public `[`point`](/Klein/api/kln::point#structkln_1_1point)` KLN_VEC_CALL `[`operator()`](#structkln_1_1motor_1afa77e3a1d5a8f28bf6eee4de9e174489)`(`[`origin`](/Klein/api/kln::origin#structkln_1_1origin)`) const noexcept` | Conjugates the origin $O$ with this motor and returns the result $mO\widetilde{m}$.
66
+
`public `[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` KLN_VEC_CALL `[`operator()`](#structkln_1_1motor_1ac8debbfe23b80affa7bf9ef7e0dffc1f)`(`[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` const & d) const noexcept` | Conjugates a direction $d$ with this motor and returns the result $md\widetilde{m}$.
67
+
`public void KLN_VEC_CALL `[`operator()`](#structkln_1_1motor_1aff385bad1df3b7ee29439b56bec43376)`(`[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` * in,`[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` * out,size_t count) const noexcept` | Conjugates an array of directions with this motor in the input array and stores the result in the output array. Aliasing is only permitted when `in == out` (in place motor application).
30
68
31
69
### Members
32
70
@@ -97,3 +135,20 @@ Conjugates an array of points with this motor in the input array and stores the
97
135
98
136
Conjugates the origin $O$ with this motor and returns the result $mO\widetilde{m}$.
Conjugates an array of directions with this motor in the input array and stores the result in the output array. Aliasing is only permitted when `in == out` (in place motor application).
147
+
148
+
The cost of this operation is the same as the application of a rotor due to the translational invariance of directions (points at infinity).
149
+
150
+
!!! tip
151
+
When applying a motor to a list of tightly packed directions, this
152
+
routine will be *significantly faster* than applying the motor to
Copy file name to clipboardExpand all lines: docs/api/kln::rotor.md
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,44 @@ struct kln::rotor
5
5
: public kln::entity< 0b10 >
6
6
```
7
7
8
+
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.
9
+
10
+
!!! example
11
+
```c++
12
+
// Initialize a point at (1, 3, 2)
13
+
kln::point p{1.f, 3.f, 2.f};
14
+
15
+
// Create a normalized rotor representing a pi/2 radian
16
+
// rotation about the xz-axis.
17
+
kln::rotor r{M_PI * 0.5f, 1.f, 0.f, 1.f};
18
+
19
+
// Rotate our point using the created rotor
20
+
kln::point rotated = r(p);
21
+
```
22
+
We can rotate lines and planes as well using the rotor's call operator.
23
+
24
+
25
+
Rotors can be multiplied to one another with the `*` operator to create a new rotor equivalent to the application of each factor.
26
+
27
+
!!! example
28
+
```c++
29
+
// Create a normalized rotor representing a $\frac{\pi}{2}$ radian
30
+
// rotation about the xz-axis.
31
+
kln::rotor r1{M_PI * 0.5f, 1.f, 0.f, 1.f};
32
+
33
+
// Create a second rotor representing a $\frac{\pi}{3}$ radian
34
+
// rotation about the yz-axis.
35
+
kln::rotor r2{M_PI / 3.f, 0.f, 1.f, 1.f};
36
+
37
+
// Use the geometric product to create a rotor equivalent to first
38
+
// applying r1, then applying r2. Note that the order of the
39
+
// operands here is significant.
40
+
kln::rotor r3 = r2 * r1;
41
+
```
42
+
43
+
44
+
The same `*` operator can be used to compose the rotor's action with other translators and motors.
45
+
8
46
### Summary
9
47
10
48
Members | Descriptions
@@ -21,6 +59,8 @@ struct kln::rotor
21
59
`public void KLN_VEC_CALL `[`operator()`](#structkln_1_1rotor_1aad794881fa0c11fb05486986032a431a)`(`[`line`](/Klein/api/kln::line#structkln_1_1line)` * in,`[`line`](/Klein/api/kln::line#structkln_1_1line)` * 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).
22
60
`public `[`point`](/Klein/api/kln::point#structkln_1_1point)` KLN_VEC_CALL `[`operator()`](#structkln_1_1rotor_1a5aabb4caa402fb5793807fe1d8cec199)`(`[`point`](/Klein/api/kln::point#structkln_1_1point)` const & p) const noexcept` | Conjugates a point $p$ with this rotor and returns the result $rp\widetilde{r}$.
23
61
`public void KLN_VEC_CALL `[`operator()`](#structkln_1_1rotor_1aa91e4024d7368fbd14a93ead29905aad)`(`[`point`](/Klein/api/kln::point#structkln_1_1point)` * in,`[`point`](/Klein/api/kln::point#structkln_1_1point)` * 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).
62
+
`public `[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` KLN_VEC_CALL `[`operator()`](#structkln_1_1rotor_1a80935add9a99987a59879df1aa868b43)`(`[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` const & d) const noexcept` | Conjugates a direction $d$ with this rotor and returns the result $rd\widetilde{r}$.
63
+
`public void KLN_VEC_CALL `[`operator()`](#structkln_1_1rotor_1a185ca5be93f00396e5e0de9a05561999)`(`[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` * in,`[`direction`](/Klein/api/kln::direction#structkln_1_1direction)` * 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).
24
64
25
65
### Members
26
66
@@ -89,3 +129,16 @@ Conjugates an array of points with this rotor in the input array and stores the
89
129
routine will be *significantly faster* than applying the rotor to
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).
139
+
140
+
!!! tip
141
+
When applying a rotor to a list of tightly packed directions, this
142
+
routine will be *significantly faster* than applying the rotor to
Copy file name to clipboardExpand all lines: docs/api/kln::translator.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,38 @@ struct kln::translator
5
5
: public kln::entity< 0b110 >
6
6
```
7
7
8
+
A translator represents a rigid-body displacement along a normalized axis. To apply the translator to a supported entity, the call operator is available.
9
+
10
+
!!! example
11
+
```c++
12
+
// Initialize a point at (1, 3, 2)
13
+
kln::point p{1.f, 3.f, 2.f};
14
+
15
+
// Create a normalized translator representing a 4-unit
16
+
// displacement along the xz-axis.
17
+
kln::translator r{4.f, 1.f, 0.f, 1.f};
18
+
19
+
// Displace our point using the created translator
20
+
kln::point translated = r(p);
21
+
```
22
+
We can translate lines and planes as well using the translator's call
23
+
operator.
24
+
25
+
26
+
Translators can be multiplied to one another with the `*` operator to create a new translator equivalent to the application of each factor.
27
+
28
+
!!! example
29
+
```c++
30
+
// Suppose we have 3 translators t1, t2, and t3
31
+
32
+
// The translator t created here represents the combined action of
33
+
// t1, t2, and t3.
34
+
kln::translator t = t3 * t2 * t1;
35
+
```
36
+
37
+
38
+
The same `*` operator can be used to compose the translator's action with other rotors and motors.
0 commit comments