In [2]:
from sympy import *
from galgebra.ga import Ga
from galgebra.printer import Format
Format()
The following follows definitions in Homogeneous Coordinates for Computational Geometry by Hestenes and Rockwood.
In [82]:
cga3d = Ga(r'e_1 e_2 e_3 e e_{0}',g='1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 -1,0 0 0 -1 0')
In [83]:
cga3d.g
Out[83]:
In [84]:
e1,e2,e3,e,e0 = cga3d.mv()
In [90]:
ep = Rational(1,2) * e - e0
ep
Out[90]:
In [91]:
en = Rational(1,2) * e + e0
en
Out[91]:
In [114]:
ep**2
Out[114]:
In [115]:
en**2
Out[115]:
In [116]:
ep|en
Out[116]:
In [85]:
e0**2
Out[85]:
In [86]:
e**2
Out[86]:
In [87]:
E = e^e0
E
Out[87]:
In [98]:
E == ep^en == ep * en
Out[98]:
In [101]:
E**2
Out[101]:
In [89]:
E.rev() == -E
Out[89]:
In [111]:
E * ep == -en
Out[111]:
In [113]:
E * en == -ep
Out[113]:
In [117]:
ep * E == en
Out[117]:
In [118]:
en * E == ep
Out[118]:
In [97]:
E * e == - e * E == -e
Out[97]:
In [102]:
E * e0 == - e0 * E == e0
Out[102]:
In [105]:
1 - E == -e * e0
Out[105]:
In [104]:
1 + E == -e0 * e
Out[104]:
The following follows definitions in https://observablehq.com/@enkimute/ganja-js-cheat-sheets
In [119]:
cga3d = Ga(r'e_1 e_2 e_3 e_{+} e_{-}',g='1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 1 0,0 0 0 0 -1')
In [120]:
cga3d.g
Out[120]:
In [121]:
e1,e2,e3,ep,en = cga3d.mv()
In [130]:
no = e0 = en - ep
e0
Out[130]:
In [131]:
e = ni = Rational(1, 2) * (ep + en)
e
Out[131]:
In [132]:
ep**2
Out[132]:
In [133]:
en**2
Out[133]:
In [134]:
ep|en
Out[134]:
In [135]:
e0**2
Out[135]:
In [136]:
e**2
Out[136]:
In [137]:
E = e^e0
E
Out[137]:
In [138]:
E == ep^en == ep * en
Out[138]:
In [139]:
E**2
Out[139]:
In [140]:
E.rev() == -E
Out[140]:
In [141]:
E * ep == -en
Out[141]:
In [142]:
E * en == -ep
Out[142]:
In [143]:
ep * E == en
Out[143]:
In [144]:
en * E == ep
Out[144]:
In [145]:
E * e == - e * E == -e
Out[145]:
In [146]:
E * e0 == - e0 * E == e0
Out[146]:
In [147]:
1 - E == -e * e0
Out[147]:
In [148]:
1 + E == -e0 * e
Out[148]:
The following follows definitions in GA4CS.
The following follows definitions in GA4P.
In [ ]: