Conformal Geometric Algebra
Conformal geometric algebra (CGA) is an elegant projective model of points, lines, circles, planes, spheres, and other objects in $\mathbb{R}^n$ using blades in a geometric algebra over $\mathbb{R}^{n + 2}$.
This package includes a small submodule which defines CGA and a few important operations, including standardform
for classifying blades and the functions ipns
and opns
for obtaining the geometric forms represented by a blade.
You can obtain the standard basis blades for $n$-D CGA using the CGA{n}
metric signature.
julia> using GeometricAlgebra.Conformal
julia> basis(CGA{3})
5-element Vector{BasisBlade{GeometricAlgebra.Conformal.CGA{3}, 1, Int64}}: 1 v1 1 v2 1 v3 1 vp 1 vm
Notice that CGA includes two extra basis vectors: vp
and vm
squaring to $+1$ and $-1$, respectively. More generally, any metric signature Sig
(defining the base space) has a conformalisation CGA{Sig}
with two extra dimensions.
The representation of points in $\mathbb{R}^n$
In CGA, points $p \in \mathbb{R}^n$ are represented by null vectors (squaring to zero) in $\mathbb{R}^{n + 2}$ given by the map
\[\begin{align*} \operatorname{up} &: \mathbb{R}^n \to \mathbb{R}^{n + 2} \\ \operatorname{up}(p) &= n_0 + p + \frac12 p^2 n_\infty \end{align*}\]
where $n_0$ and $n_\infty$ are null basis vector satisfying $n_0^2 = n_\infty^2 = 0$ and $n_0 \cdot n_\infty = -1$. In terms of standard basis vectors, they are defined as n0 = (vm - vp)/2
and noo = vm + vp
and can be obtained with nullbasis
, origin
and infinity
.
julia> n0, noo = Conformal.nullbasis(3);
Use the up
function to lift $1$-vectors from a base space with signature Sig
into CGA{Sig}
:
julia> @basis 3
[ Info: Defined basis blades v1, v2, v3, v12, v13, v23, v123, I in Main
julia> p = v1 + 2v2 + 3v3
3-component Multivector{3, 1, SVector{3, Int64}}: 1 v1 2 v2 3 v3
julia> up(p)
5-component Multivector{GeometricAlgebra.Conformal.CGA{3}, 1, SVector{5, Float64}}: 1.0 v1 2.0 v2 3.0 v3 6.5 vp 7.5 vm
julia> ans == n0 + p + 2\p^2*noo # multivectors in Sig and CGA{Sig} are promoted
true
The overall scale of vectors (and blades) in CGA does not matter; it is a homogeneous model. We can go the other way with the down map, dn
.
julia> p == dn(up(p)) == dn(100up(p))
true
You may notice that $n_0$ itself is equal to $\operatorname{up}(0)$ and $n_\infty$ is the limit of $\operatorname{up}(x)/\|x\|^2$ as $x$ goes to infinity in any direction. We interpret $n_0$ as the origin and $n_∞$ as the unique point at infinity.
Standard form of CGA blades
It is useful to represent blades in CGA{Sig}
in purely terms of $n_0$, $n_∞$ and objects in the base space Sig
.
In fact, any blade $X$ in CGA{Sig}
is of exactly one of the four forms represented by the subtypes of CGABlade
.
CGABlade Subtype | Mathematical form | $X \wedge n_\infty$ | $X \lfloor n_\infty$ |
---|---|---|---|
DirectionBlade | $\bm{E} \wedge n_\infty$ | $=0$ | $=0$ |
FlatBlade | $\mathtt{T}_{\bm{p}}[n_0 \wedge \bm{E} \wedge n_\infty]$ | $=0$ | $\ne0$ |
DualFlatBlade | $\mathtt{T}_{\bm{p}}[\bm{E}]$ | $\ne0$ | $=0$ |
RoundBlade | $\mathtt{T}_{\bm{p}}[(n_0 \pm \textstyle{\frac 12} r^2 n_\infty) \wedge \bm{E}]$ | $\ne0$ | $\ne0$ |
Here, $\bm{E}$ is any blade in the base space, $\mathtt{T}_{\bm{p}}$ is the operator which translate
s by the base space vector $\bm{p}$ and $r$ is a scalar radius parameter.
The standardform
method converts any blade in CGA{Sig}
to one of these representations.
julia> standardform(v12 + 2v1∧noo)
GeometricAlgebra.Conformal.DualFlatBlade{3, 2}: 2-blade of the form translate(p, E): E = 1.0 v12 p = 2.0 v2
This example shows how $𝐯_1𝐯_2 + 2𝐯_2∧n_∞$ can be written as $𝚃_{2𝐯_2}[𝐯_1𝐯_2]$.
Geometric objects represented by CGA blades
Any CGA blade $X$ can be associated with a subset of the base space $\mathbb{R}^n$ in two ways related by duality, providing clear geometrical meaning. Define the inner and outer product null spaces[1], obtained with ipns
and opns
:
\[\begin{align*} \operatorname{ipns}(X) &\coloneqq \{p \in \mathbb{R}^n \cup \{∞\} \mid \operatorname{up}(p) \mathop\rfloor X = 0 \} \\ \operatorname{opns}(X) &\coloneqq \{p \in \mathbb{R}^n \cup \{∞\} \mid \operatorname{up}(p) \wedge X = 0 \} \end{align*}\]
These are related by duality so that ipns(x) == opns(hodgedual(x))
and ipns(hodgedual(x)) == opns(x)
.
Possible values of $\operatorname{ipns}$ or $\operatorname{opns}$ are the following subsets of the extended base space $\mathbb{R}^n \cup \{∞\}$:
- the empty set,
- an affine $k$-plane (point, line, plane, and so on) which contains $∞$,
- a $k$-sphere (point, point pair, circle, sphere, and so on),
- the point at infinity.
Geometric objects of these kinds are represented by the FlatGeometry
and RoundGeometry
subtypes of CGAGeometry
.
CGABlade Subtype | $\operatorname{ipns}$ | $\operatorname{opns}$ |
---|---|---|
DirectionBlade | PointAtInfinity | PointAtInfinity |
FlatBlade | EmptySet | FlatGeometry |
DualFlatBlade | FlatGeometry | EmptySet |
RoundBlade | RoundGeometry | RoundGeometry |
For example, below we find that $\operatorname{opns}$ of the outer product of three conformal points is a circle with a centre, direction and real radius.
julia> p, q, r = up.(randn(Multivector{3,1}, 3));
julia> opns(p∧q∧r)
GeometricAlgebra.Conformal.RoundGeometry{3, 2}: 2-round (circle) around center p spanning E with square radius r2: p = 0.822903 v1 + -4.67489 v2 + 0.651362 v3 E = -0.451375 v12 + -0.479854 v13 + -2.03864 v23 r2 = 20.339048195883557
- 1In an abuse of notation, $\operatorname{up}(∞) = n_∞$. More formally, one may define these as subsets of the projective space $Q \subset \mathbf{P}\mathbb{R}^{n + 2}$ of null vectors, $Q = \{[\operatorname{up}(p)] \mid p \in \mathbb{R}^n\} \cup \{[n_\infty]\}$ where $[\quad]$ is the projective equivalence class. Then we have $\operatorname{ipns}(X) = \{x \in Q \mid x \mathop\rfloor X = 0\}$ and similarly for $\operatorname{opns}$.