11from .test_utils import TestCase
22
3- from sympy import Symbol , S
3+ from sympy import Symbol , S , sqrt
44from galgebra .ga import Ga
55
66
@@ -11,14 +11,43 @@ def setUp(self):
1111 Initialize CGA.
1212 """
1313 g = [
14- [+ 0 , + 0 , + 0 , + 0 , - 1 ],
15- [+ 0 , + 1 , + 0 , + 0 , + 0 ],
16- [+ 0 , + 0 , + 1 , + 0 , + 0 ],
17- [+ 0 , + 0 , + 0 , + 1 , + 0 ],
18- [- 1 , + 0 , + 0 , + 1 , + 0 ],
14+ [ 1 , 0 , 0 , 0 , 0 ],
15+ [ 0 , 1 , 0 , 0 , 0 ],
16+ [ 0 , 0 , 1 , 0 , 0 ],
17+ [ 0 , 0 , 0 , 1 , 0 ],
18+ [ 0 , 0 , 0 , 0 , - 1 ],
1919 ]
2020
21- self .ga , self .o , self .e_1 , self .e_2 , self .e_3 , self .inf = Ga .build ('o e1 e2 e3 inf' , g = g )
21+ ga , e , e_1 , e_2 , e_3 , eb = Ga .build ('e e1 e2 e3 eb' , g = g )
22+ o = S .Half * (e + eb )
23+ inf = eb - e
24+
25+ self .ga = ga
26+ self .o = o
27+ self .e_1 = e_1
28+ self .e_2 = e_2
29+ self .e_3 = e_3
30+ self .inf = inf
31+
32+ """
33+ # test_13_2_2 will fails with this
34+
35+ g = [
36+ [ 0, 0, 0, 0, -1],
37+ [ 0, 1, 0, 0, 0],
38+ [ 0, 0, 1, 0, 0],
39+ [ 0, 0, 0, 1, 0],
40+ [-1, 0, 0, 0, 0],
41+ ]
42+
43+ ga, o, e_1, e_2, e_3, inf = Ga.build('o e1 e2 e3 inf', g=g)
44+ self.ga = ga
45+ self.o = o
46+ self.e_1 = e_1
47+ self.e_2 = e_2
48+ self.e_3 = e_3
49+ self.inf = inf
50+ """
2251
2352 def vector (self , x , y , z ):
2453 """
@@ -94,3 +123,26 @@ def test_13_1_3(self):
94123 im_s = self .dual_im_sphere (alpha , c , r )
95124 self .assertEqual (im_s | im_s , - alpha * alpha * r * r )
96125 self .assertEqual (- self .inf | im_s , alpha )
126+
127+ def test_13_2_2 (self ):
128+ """
129+ Proper Euclidean motions as even versors : Translations.
130+ """
131+
132+ nx = Symbol ('nx' , real = True )
133+ ny = Symbol ('ny' , real = True )
134+ nz = Symbol ('nz' , real = True )
135+
136+ n = self .vector (nx , ny , nz ) / sqrt (nx * nx + ny * ny + nz * nz )
137+ delta_1 = Symbol ('delta_1' , real = True )
138+ delta_2 = Symbol ('delta_2' , real = True )
139+
140+ Tt = self .dual_plane (n , delta_2 ) * self .dual_plane (n , delta_1 )
141+
142+ # Even versor
143+ self .assertEqual (Tt * Tt .rev (), 1 )
144+
145+ # Translation
146+ r = Tt * self .o * Tt .inv ()
147+ t = self .point (1 , 2 * (delta_2 - delta_1 ) * n )
148+ self .assertEqual (r , t )
0 commit comments