Thank  you all who attended - (course notes are here)

Thank  you all who attended - the video will be linked when available. (course notes are here)

Today

  • Computer Geometry
  • Coordinate Free
  • Projective Geometry
  • Geometric Numbers
  • Geometric Algebra
  • 2D PGA
  • 3D PGA

Computer Geometry

Computer Geometry

point

direction

line

plane

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

position

rotation

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

position

rotation

matrix

// construct transformations
mtx_translate (x, y, z)
mtx_rotate_euler (h, p, b)
mtx_rotate_axis_angle (x, y, z, a)
mtx_look_at (from, too, pole)

// apply transformations
transform_point (M, p)
transform_direction (M, d)
transform_line (M, l)
transform_plane (M, P)

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

position

rotation

matrix

quaternion

// construct transformations
mtx_translate (x, y, z)
mtx_rotate_euler (h, p, b)
mtx_rotate_axis_angle (x, y, z, a)
mtx_look_at (from, too, pole)

// apply transformations
transform_point (M, p)
transform_direction (M, d)
transform_line (M, l)
transform_plane (M, P)
// construct transformations
quat_from_euler (h, p, b)
quat_from_axis_angle (x, y, z, a)
quat_look_at (from, too, pole)
quat_from_matrix (M)
quat_to_matrix (Q)

// apply transformations
transform_point (Q, p)
transform_line (Q, l)
transform_plane (Q, P)

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

position

rotation

matrix

quaternion

// construct transformations
mtx_translate (x, y, z)
mtx_rotate_euler (h, p, b)
mtx_rotate_axis_angle (x, y, z, a)
mtx_look_at (from, too, pole)

// apply transformations
transform_point (M, p)
transform_direction (M, d)
transform_line (M, l)
transform_plane (M, P)
// construct transformations
quat_from_euler (h, p, b)
quat_from_axis_angle (x, y, z, a)
quat_look_at (from, too, pole)
quat_from_matrix (M)
quat_to_matrix (Q)

// apply transformations
transform_point (Q, p)
transform_line (Q, l)
transform_plane (Q, P)

velocity

force

tensor

// LA LA Land
factor_QR (M)
factor_LDL (M)
factor_SVD (M)
factor_LU (M)

.. eigenvalues ..
.. gradient descent ..
.. LMA .. 
.. back prop .. 
.. AD .. 

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

position

rotation

matrix

quaternion

// construct transformations
mtx_translate (x, y, z)
mtx_rotate_euler (h, p, b)
mtx_rotate_axis_angle (x, y, z, a)
mtx_look_at (from, too, pole)

// apply transformations
transform_point (M, p)
transform_direction (M, d)
transform_line (M, l)
transform_plane (M, P)
// construct transformations
quat_from_euler (h, p, b)
quat_from_axis_angle (x, y, z, a)
quat_look_at (from, too, pole)
quat_from_matrix (M)
quat_to_matrix (Q)

// apply transformations
transform_point (Q, p)
transform_line (Q, l)
transform_plane (Q, P)

velocity

force

tensor

dual quaternion

// LA LA Land
factor_QR (M)
factor_LDL (M)
factor_SVD (M)
factor_LU (M)

.. eigenvalues ..
.. gradient descent ..
.. LMA .. 
.. back prop .. 
.. AD .. 
// and even more code..
dquat_to_matrix (DQ)
dquat_from_matrix (M)
dquat_from_direction (d)
dquat_from_euler (h, p, b)

.. meshes ..
.. computational geometry .. 
.. keeps going ..

Computer Geometry

point

direction

line

plane

// construct lines
line_from_points (p1, p2)
line_from_points_and_dir (p, d)
line_from_plucker (a, b, c, d, e, f)

// construct planes
plane_from_points (p1, p2, p3)
plane_from_point_and_dirs (p, d1, d2)
plane_from_points_and_dir (p1, p2, d)
plane_from_point_and_line (p, l)
plane_from_equation (a, b, c, d)

// Intersections
intersect_line_plane (l, P)
intersect_plane_plane (P1, P2)
intersect_planes (P1, P2, P3)

// Projections
project_point_plane (p, P)
project_line_plane (l, P)
project_point_line (p, l)

position

rotation

matrix

quaternion

// construct transformations
mtx_translate (x, y, z)
mtx_rotate_euler (h, p, b)
mtx_rotate_axis_angle (x, y, z, a)
mtx_look_at (from, too, pole)

// apply transformations
transform_point (M, p)
transform_direction (M, d)
transform_line (M, l)
transform_plane (M, P)
// construct transformations
quat_from_euler (h, p, b)
quat_from_axis_angle (x, y, z, a)
quat_look_at (from, too, pole)
quat_from_matrix (M)
quat_to_matrix (Q)

// apply transformations
transform_point (Q, p)
transform_line (Q, l)
transform_plane (Q, P)

velocity

force

tensor

dual quaternion

// LA LA Land
factor_QR (M)
factor_LDL (M)
factor_SVD (M)
factor_LU (M)

.. eigenvalues ..
.. gradient descent ..
.. LMA .. 
.. back prop .. 
.. AD .. 
// and even more code..
dquat_to_matrix (DQ)
dquat_from_matrix (M)
dquat_from_direction (d)
dquat_from_euler (h, p, b)

.. meshes ..
.. computational geometry .. 
.. keeps going ..

VECTOR AND MATRIX ALGEBRA

Computer Geometry

point

direction

line

plane

position

rotation

matrix

quaternion

velocity

force

dual quaternion

VECTOR AND MATRIX ALGEBRA

VECTOR

  • natural choice for ANALYTIC GEOMETRY
  • lots of design choices (axes, chirality, rotation order)
  • lots of coordinates
  • lots of exceptions
  • lots of conversions (quaternion,euler,matrix,...)
  • lots of programming/testing
  • feels like bookkeeping

Geometric Objects are represented by choosing axes, taking measurements and writing down coefficients. Formulas produce and functions transform these measurements.

Computer Geometry

VECTOR AND MATRIX ALGEBRA

  • natural choice for ANALYTIC GEOMETRY
  • describe geometric objects with measurements
  • one bag of for each measurement
  • formulas, transformations describe what happens to the measurements.
Rn\mathbb R^n
\mathbb R^n

Computer Geometry

VECTOR AND MATRIX ALGEBRA

  • natural choice for ANALYTIC GEOMETRY
  • describe geometric objects with measurements
  • one bag of for each measurement
  • formulas, transformations describe what happens to the measurements.

PROJECTIVE GEOMETRIC ALGEBRA

  • natural choice for ``SYNTHETIC´´ GEOMETRY
  • new bag, each element in it IS a geometric object
  • formulas, transformations describe what happens to the objects
  • no coordinates, chirality, exceptions, conversions
Rn\mathbb R^n
\mathbb R^n
Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}

Computer Geometry

ANALYTIC GEOMETRY : VECTOR AND MATRIX ALGEBRA

Rn\mathbb R^n
\mathbb R^n
x=acosα+bcosβcosαx = a \cos \alpha + b \cos \beta \cos \alpha
x = a \cos \alpha + b \cos \beta \cos \alpha
y=asinα+bcosβsinαy = a \sin \alpha + b \cos \beta \sin \alpha
y = a \sin \alpha + b \cos \beta \sin \alpha
z=bsinβz = b \sin \beta
z = b \sin \beta

Computer Geometry

ANALYTIC GEOMETRY : VECTOR AND MATRIX ALGEBRA

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn\mathbb R^n
\mathbb R^n
Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
x=acosα+bcosβcosαx = a \cos \alpha + b \cos \beta \cos \alpha
x = a \cos \alpha + b \cos \beta \cos \alpha
y=asinα+bcosβsinαy = a \sin \alpha + b \cos \beta \sin \alpha
y = a \sin \alpha + b \cos \beta \sin \alpha
z=bsinβz = b \sin \beta
z = b \sin \beta
p=  eβxz    ebx    eαxy    eax    o{p} =\, \,e^{\beta_{xz}}\,\,\,\,e^{b_x}\,\,\,\,e^{\alpha_{xy}}\,\,\,\,e^{a_x}\,\,\,\,\mathbf{o}
{p} =\, \,e^{\beta_{xz}}\,\,\,\,e^{b_x}\,\,\,\,e^{\alpha_{xy}}\,\,\,\,e^{a_x}\,\,\,\,\mathbf{o}

Computer Geometry

ANALYTIC GEOMETRY : VECTOR AND MATRIX ALGEBRA

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn\mathbb R^n
\mathbb R^n
Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
x=acosα+bcosβcosαx = a \cos \alpha + b \cos \beta \cos \alpha
x = a \cos \alpha + b \cos \beta \cos \alpha
y=asinα+bcosβsinαy = a \sin \alpha + b \cos \beta \sin \alpha
y = a \sin \alpha + b \cos \beta \sin \alpha
z=bsinβz = b \sin \beta
z = b \sin \beta
p=  eβxzebxeαxyeax{p} =\, \,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet
{p} =\, \,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet

synthetic : tools are ruler \rightarrow and compass \curvearrowleft

elements are points, lines, planes, ..

Computer Geometry

ANALYTIC GEOMETRY : VECTOR AND MATRIX ALGEBRA

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn\mathbb R^n
\mathbb R^n
Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
x=acosα+bcosβcosαx = a \cos \alpha + b \cos \beta \cos \alpha
x = a \cos \alpha + b \cos \beta \cos \alpha
y=asinα+bcosβsinαy = a \sin \alpha + b \cos \beta \sin \alpha
y = a \sin \alpha + b \cos \beta \sin \alpha
z=bsinβz = b \sin \beta
z = b \sin \beta
p=  eβxzebxeαxyeax{p} =\, \,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet
{p} =\, \,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet

synthetic : tools are ruler \rightarrow and compass \curvearrowleft

elements are points, lines, planes, ..

Computer Geometry

ANALYTIC GEOMETRY : VECTOR AND MATRIX ALGEBRA

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn\mathbb R^n
\mathbb R^n
Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
x=acosα+bcosβcosαx = a \cos \alpha + b \cos \beta \cos \alpha
x = a \cos \alpha + b \cos \beta \cos \alpha
y=asinα+bcosβsinαy = a \sin \alpha + b \cos \beta \sin \alpha
y = a \sin \alpha + b \cos \beta \sin \alpha
z=bsinβz = b \sin \beta
z = b \sin \beta
p=  eβxzebxeαxyeax{p} =\, \,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet
{p} =\, \,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet

{

{

2D

3D

.. just as in topology .. circle times circle ..
 

Computer Geometry

ANALYTIC GEOMETRY : VECTOR AND MATRIX ALGEBRA

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn\mathbb R^n
\mathbb R^n
Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
x=acosα+bcosβcosα+ccosγcosβcosαx = a \cos \alpha + b \cos \beta \cos \alpha + c \cos \gamma \cos \beta \cos \alpha
x = a \cos \alpha + b \cos \beta \cos \alpha + c \cos \gamma \cos \beta \cos \alpha
y=asinα+bcosβsinα+ccosγcosβsinαy = a \sin \alpha + b \cos \beta \sin \alpha + c \cos \gamma \cos \beta \sin \alpha
y = a \sin \alpha + b \cos \beta \sin \alpha + c \cos \gamma \cos \beta \sin \alpha
z=bsinβ+ccosγsinβz = b \sin \beta + c \cos \gamma \sin \beta
z = b \sin \beta + c \cos \gamma \sin \beta
p=  eγxwecxeβxzebxeαxyeax{p} =\, \,\curvearrowleft^{e^{\gamma_{xw}}}\,\rightarrow^{e^{c_x}}\,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet
{p} =\, \,\curvearrowleft^{e^{\gamma_{xw}}}\,\rightarrow^{e^{c_x}}\,\curvearrowleft^{e^{\beta_{xz}}}\,\rightarrow^{e^{b_x}}\,\curvearrowleft^{e^{\alpha_{xy}}}\,\rightarrow^{e^{a_x}}\,\bullet

{

{

2D

3D

{

4D

w=csinγw = c \sin \gamma
w = c \sin \gamma

.. just as in topology .. circle times circle times circle ..
 

Computer Geometry

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
  • We want synthetic geometry.
  • Work with objects not measurements.
  • So how to write it down ? (..algebra..)
  • But first .. what do we want in our bag ?

Computer Geometry

SYNTHETIC GEOMETRY : PROJECTIVE GEOMETRIC ALGEBRA

Rn,0,1\mathbb R^*_{n,0,1}
\mathbb R^*_{n,0,1}
  • We want synthetic geometry.
  • Work with objects not measurements.
  • So how to write it down ? (..algebra..)
  • But first .. what do we want in our bag ?

GEOMETRIC OBJECTS : POINTS, LINES, PLANES, ROTATIONS, TRANSLATIONS, ...

 

The elements of Geometry - in our case Projective Geometry

NOTE : we will work first in 2D, but in a way that will generalize to nD.

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

We embed a 2D plane in a 3D space and call it the projective plane.

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

We associate each projective point in 2D with a line through the origin in 3D

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

Lines that do not intersect the projective plane are associated with infinite points

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

#points_in_plane + #infinite_points = #lines_through_origin_in_3D

What about lines ?

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

We associate each projective line in 2D with a plane through the origin in 3D

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

The one plane parallel to the projective plane is associated with 1 infinite line

#points_in_plane + #infinite_points = #lines_through_origin_in_3D

#lines_in_plane + 1 = #planes_through_origin_in_3D

This works the same way in n-d and is called the Projective Map.

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

The planes always intersect, and so do their corresponding lines .. even at infinity.

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

The planes always intersect, and so do their corresponding lines .. even at infinity.

This means your code to intersect two lines has no exceptions, and the code that uses it has no if statements

...
// find intersection
  var point = intersect_lines(line1, line2)

// always a valid result. (possibly infinite point).
// no checking - just use it ! 
...

What happens when you rotate around an infinite point ?

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

#points_in_plane + #infinite_points = #lines_through_origin_in_3D

#lines_in_plane + 1 = #planes_through_origin_in_3D

#lines_through_origin_in_3D = #planes_through_origin_in_3D

each 3D line is orthogonal to exactly one 3D plane so we also have :

that also means the same amount of projective points and lines !

so we can relate projective lines and planes leading to Duality

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

JOIN of two points is dual to MEET of their two dual lines

DUALITY : associate each projective point with one projective line

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

JOIN of two points is dual to MEET of two lines

line is collection of points on it

point is collection of lines through it

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

JOIN of two points is dual to MEET of two lines

your code to intersect two lines can also be used to join two points.

function join_points(point1,point2) {
  // dualize input points
  var line1 = dual(point1);
  var line2 = dual(point2);
  // find intersection point.
  var intersection_point = intersect_lines(line1, line2);
  // return the dual line of this point
  return dual(intersection_point); 
}

point

lies on

line

intersect

Works for all your functions !!!!!

Projective Geometry

Rotate around \infty = Push at CoG

Rotate around CoG = Push at \infty







 

Rotate around CoG

Rotate around \infty

Push at \infty

Push at CoG

ALL FORCES ARE LINEAR, ALSO THE ANGULAR ONES, BOTH IN 2D AND 3D !

lines are special !

\curvearrowleft

\curvearrowleft

\uparrow

\uparrow

\curvearrowleft

\infty

\infty

\uparrow

Projective Geometry

Represent Euclidean points/lines/... in n-d using an (n+1)d space. 

  • all euclidean points,lines,planes, .. 
  • all ideal (infinite) points,lines,planes, ..
  • robust, exception free incidence relations
  • translations are rotations around \infty
  • duality

Where are the formula's and numbers ? We have changed our difficult to write down arbitrary points and lines to slightly less difficult to write down entities through the origin. For lines through the origin we can use VECTORS, but lets think some more on the writing down .. enter Algebra.

Algebra

  x2+10x=39  \,\,x^2 + 10x = 39\,\,
\,\,x^2 + 10x = 39\,\,

What picture do you get when you see this equation ?

Algebra

  x2+10x=39  \,\,x^2 + 10x = 39\,\,
\,\,x^2 + 10x = 39\,\,

What picture do you get when you see this equation ?

Algebra

  x2+10x=39  \,\,x^2 + 10x = 39\,\,
\,\,x^2 + 10x = 39\,\,

Algebra

  x2+10x=39  \,\,x^2 + 10x = 39\,\,
\,\,x^2 + 10x = 39\,\,
ax² = bx ax² = c
bx = c ax² + bx = c
ax² + c = bx bx + c = ax²

Al-Khwarizmi's six problems

Today, one problem :

ax2+bx+c=0\quad\quad ax^2 + bx + c = 0\quad\quad
\quad\quad ax^2 + bx + c = 0\quad\quad

What was Al-Khwarizmi missing ?

Algebra

  x2+10x=39  \,\,x^2 + 10x = 39\,\,
\,\,x^2 + 10x = 39\,\,
ax² = bx ax² = c
bx = c ax² + bx = c
ax² + c = bx bx + c = ax²

Al-Khwarizmi's six problems

Today, one problem :

ax2+bx+c=0\quad\quad ax^2 + bx + c = 0\quad\quad
\quad\quad ax^2 + bx + c = 0\quad\quad

What was Al-Khwarizmi missing ?

no negative numbers, no zero

more numbers, less formulas, less code.

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

what are these crazy un-natural numbers ?

x+1=0x \quad + \quad 1 \quad = \quad 0
x \quad + \quad 1 \quad = \quad 0
xNx \notin \mathbb N
x \notin \mathbb N
x2Nx^2 \in \mathbb N
x^2 \in \mathbb N

\rightarrow They're not natural numbers !

\rightarrow Yet they square to a natural number ??

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1
\curvearrowleft
\curvearrowleft
xRx \notin \mathbb R
x \notin \mathbb R

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1
\curvearrowleft
\curvearrowleft
xRx \notin \mathbb R
x \notin \mathbb R
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1
\curvearrowleft
\curvearrowleft
xRx \notin \mathbb R
x \notin \mathbb R
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1
\curvearrowleft
\curvearrowleft
xRx \notin \mathbb R
x \notin \mathbb R
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1
\curvearrowleft
\curvearrowleft
xRx \notin \mathbb R
x \notin \mathbb R
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1

Algebra

What was Al-Khwarizmi missing ?

zero            negative numbers

maybe other numbers were hiding ?

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0
x2=1x^2 = -1
x^2 = -1
\curvearrowleft
\curvearrowleft
xRx \notin \mathbb R
x \notin \mathbb R
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

BASIC INSIGHT : 0D,1D,2D,... numbers behave differently

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1

Algebra

x2+1=0x^2 \quad + \quad 1 \quad = \quad 0
x^2 \quad + \quad 1 \quad = \quad 0

THE GEOMETRIC NUMBERS

these are of course the complex, hyperbolic and dual numbers. So why call them geometric numbers ? lets find out ..

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

Algebra - The Geometric Numbers

Addition and Scalar multiplication are trivial : 

a lemon plus a lemon is almost always two lemons.

e+e=2ee_- + e_- = 2e_-
e_- + e_- = 2e_-
e++e+=2e+e_+ + e_+ = 2e_+
e_+ + e_+ = 2e_+
e0+e0=2e0e_0 + e_0 = 2e_0
e_0 + e_0 = 2e_0
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

Algebra - The Geometric Numbers

Addition and Scalar multiplication are trivial : 

a lemon plus a lemon is almost always two lemons.

e0+e0=2e0e_0 + e_0 = 2e_0
e_0 + e_0 = 2e_0

But what about multiplication ? we'll just try ..

e+e=2ee_- + e_- = 2e_-
e_- + e_- = 2e_-
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e++e+=2e+e_+ + e_+ = 2e_+
e_+ + e_+ = 2e_+
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

Algebra - The Geometric Numbers

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0
(a+be)(c+de)(a + be_-)(c + de_-)
(a + be_-)(c + de_-)

We add  e\mathbf e_-  to our bag of numbers. Each element in it is now of the form (a + be\mathbf e_-).

Algebra - The Geometric Numbers

We add  e\mathbf e_-  to our bag of numbers. Each element in it is now of the form (a + be\mathbf e_-).

=ac+ade+bce+bde2=(acbd)+(ad+bc)e= ac + ade_- + bce_- + bd{e_-}^2 \\ = (ac - bd) + (ad + bc)e_-
= ac + ade_- + bce_- + bd{e_-}^2 \\ = (ac - bd) + (ad + bc)e_-

So, nothing special to remember ! No new multiplication, just a new element in the bag.

Easy to calculate - but what does it DO ?

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0
(a+be)(c+de)(a + be_-)(c + de_-)
(a + be_-)(c + de_-)

Algebra - The Geometric Numbers

Easy to calculate - but what do they DO ?

1e=e1=eee=e2=11e=e3=eee=e4=  1\begin{aligned} 1*{e_-} &=& {e_-}^1 &=&{e_-} \\ {e_-}*{e_-} &=& {e_-}^2 &=&-1 \\ -1*{e_-} &=& {e_-}^3 &=&-{e_-} \\ -{e_-}*{e_-} &=& {e_-}^4 &=&\,\,1 \\ \end{aligned}
\begin{aligned} 1*{e_-} &=& {e_-}^1 &=&{e_-} \\ {e_-}*{e_-} &=& {e_-}^2 &=&-1 \\ -1*{e_-} &=& {e_-}^3 &=&-{e_-} \\ -{e_-}*{e_-} &=& {e_-}^4 &=&\,\,1 \\ \end{aligned}

Elements that square to -1 related to ROTATIONS

\hookrightarrow this means e-e_- is the inverse of ee_-

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

Algebra - The Geometric Numbers

Easy to calculate - but what do they DO ?

(1+ϵ)1=(1+ϵ)(1+ϵ)2=(1+2ϵ)(1+ϵ)3=(1+3ϵ)\begin{aligned} (1+\epsilon)^1 &= (1+\epsilon) \\ (1+\epsilon)^2 &= (1+2\epsilon) \\ (1+\epsilon)^3 &= (1+3\epsilon) \\ \end{aligned}
\begin{aligned} (1+\epsilon)^1 &= (1+\epsilon) \\ (1+\epsilon)^2 &= (1+2\epsilon) \\ (1+\epsilon)^3 &= (1+3\epsilon) \\ \end{aligned}

Elements that square to 0 related to TRANSLATIONS

(1+ϵ)1.5\rightarrow (1+\epsilon)^{1.5} ?

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

Algebra - The Geometric Numbers

ROTATIONS

HYPERBOLIC ROTATIONS

TRANSLATIONS

  • only around origin
  • ene_-^n is repeated multiplication
  • ene_-^n rotates in steps of 90°
  • need smooth : exe_-^x for xRx \in \mathbb R
  • only one axis
  • needs weird '+1'
  • is linear, so smooth.
eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0

Algebra - The Geometric Numbers

ROTATIONS

TRANSLATIONS

  • only one axis
  • needs weird '+1'
  • is linear, so smooth.

Also, we want translations and rotations in one bag. But first - we solve the "smooth" and "weird 1+" problems.

HYPERBOLIC ROTATIONS

eR,e2=1e_- \notin \mathbb R, {e_-}^2=-1
e_- \notin \mathbb R, {e_-}^2=-1
e+R,e+2=1e_+ \notin \mathbb R, {e_+}^2=1
e_+ \notin \mathbb R, {e_+}^2=1
e0R,e02=0e_0 \notin \mathbb R, {e_0}^2=0
e_0 \notin \mathbb R, {e_0}^2=0
  • only around origin
  • ene_-^n is repeated multiplication
  • ene_-^n rotates in steps of 90°
  • need smooth : exe_-^x for xRx \in \mathbb R

Algebra - The Exponential function

With ene_-^n where nNn \in \mathbb N we can rotate in steps. What about exe_-^x with xRx \in \mathbb R ?

(42)2=(44)2=(44)(44)=422=44{(4^2)}^2 = (4*4)^2 = (4*4)*(4*4) = 4^{2*2} = 4^4

4x=(22)x=22x4^x = {(2^2)}^x = 2^{2x}

ax=(bα)x=bαxa^x = {(b^{\alpha})}^x = b^{\alpha x}

\hookrightarrow

All exponential functions are the same, with x scaled by some constant α\alpha.

So if we can calculate one smooth axa^x with xRx \in \mathbb R, we're done.

ex=1+x1+x221+x3321+...e^x = 1 + \frac x 1 + \frac {x^2} {2*1} + \frac {x^3} {3*2*1} + ...

power can be ANYTHING

powers N\in \mathbb N

So, if you see exe^x, the ee ONLY tells you its an exponential function, the xx has all the information. With our new numbers, eαee^{\alpha e_-} are thus rotations and eαe0e^{\alpha e_0} are translations.

Algebra - The Exponential function

eαe=n=0(αe)nn!=cosα+ sinαee^{\alpha \mathbf e_-}=\sum \limits_{n=0}^\infty \cfrac {(\alpha \mathbf e_-)^n} {n!} = \cos \alpha +  \sin \alpha \mathbf e_-

\rightarrow Exponentiate αe\alpha \mathbf e_- to get a rotation (these are our smooth rotations)

eαe0=n=0(αe0)nn!=1+αe0e^{\alpha \mathbf e_0}=\sum \limits_{n=0}^\infty \cfrac {(\alpha \mathbf e_0)^n} {n!} = 1 + \alpha \mathbf e_0

\rightarrow Exponentiate αe0\alpha \mathbf e_0 to get a translation. (this is that weird +1+1)

With ene_-^n where nNn \in \mathbb N we can rotate in steps. What about exe_-^x with xRx \in \mathbb R ?

Geometric Algebra Vectors

x=ae1+be2\vec{x} = a\mathbf e_1 + b\mathbf e_2

THE CONTRACTION AXIOM :

  • We use our new ei\mathbf e_i as basis vectors. (one for each \perp axis)
  • Each vector squares to a scalar. ( x2R\vec x^2 \in \mathbb R )
  • We write all vectors as linear combinations of these basis vectors:

 

x=ae1+be2\vec{x} = a\mathbf e_1 + b\mathbf e_2

By the contraction axiom, any such vector must square to a real number :

(ae1+be2)2=a2e12+abe1e2+bae2e1+b2e22(a\mathbf e_1 + b\mathbf e_2)^2 = a^2\mathbf e_1^2 + ab\mathbf e_1\mathbf e_2 + ba\mathbf e_2\mathbf e_1 + b^2\mathbf e_2^2 

Geometric Algebra Vectors

THE CONTRACTION AXIOM :

  • We use our new ei\mathbf e_i as basis vectors. (one for each \perp axis)
  • Each vector squares to a scalar. ( x2R\vec x^2 \in \mathbb R )
  • We write all vectors as linear combinations of these basis vectors:

 

x=ae1+be2\vec{x} = a\mathbf e_1 + b\mathbf e_2

By the contraction axiom, any such vector must square to a real number :

(ae1+be2)2=a2e12+abe1e2+bae2e1+b2e22(a\mathbf e_1 + b\mathbf e_2)^2 = a^2\mathbf e_1^2 + ab\mathbf e_1\mathbf e_2 + ba\mathbf e_2\mathbf e_1 + b^2\mathbf e_2^2 

Since a2e12,b2e22a^2\mathbf e_1^2,b^2\mathbf e_2^2 are both scalar, and e1e2\mathbf e_1\mathbf e_2 and e2e1\mathbf e_2\mathbf e_1 can not be simplified :

abe1e2+bae2e1=0ab\mathbf e_1\mathbf e_2 + ba\mathbf e_2\mathbf e_1 = 0 

 

e1e2=e2e1\leftrightarrow \mathbf e_1\mathbf e_2 = -\mathbf e_2\mathbf e_1

Geometric Algebra Vectors

THE CONTRACTION AXIOM :

  • We use our new ei\mathbf e_i as basis vectors. (one for each \perp axis)
  • Each vector squares to a scalar. ( x2R\vec x^2 \in \mathbb R )
  • We write all vectors as linear combinations of these basis vectors:

 

  • use ei \mathbf e_i as \perp basis vectors

eiej=ejei\mathbf e_i\mathbf e_j = -\mathbf e_j\mathbf e_i

eiR\mathbf e_i \notin \mathbb R

ei2R\mathbf e_i^2 \in \mathbb R

Geometric Algebra Vectors

  • parallel vectors contract into scalar (+1, -1, 0)
  • orthogonal vectors anti-commute

eiej=eij\mathbf e_i\mathbf e_j = \mathbf e_{ij}

  • k-vector = product of k \neq basis vectors 

A general element of our GA is called a multivector and is the sum of a scalar, vector, bivector, ...

So, we start with two elements e1,e2\mathbf e_1, \mathbf e_2, and through multiplication we get another new element, e12\mathbf e_{12}. It is the plane our two vectors lie in.

R2,0,0:\mathbb R_{2,0,0} :

R\mathbb R

e1,e2\mathbf e_1,\mathbf e_2

e12\mathbf e_{12}

\rightarrow 0-dimensional "scalar"

\rightarrow 1-dimensional  "vector"

\rightarrow 2-dimensional "bivector"

a vector is a 1D oriented quantity. (line)

a bivector is a 2D oriented quantity. (plane)

a trivector is a 3D oriented quantity (volume)

Geometric Algebra Vectors

in practice, only two calculation rules !  eiei={+1,1,0},eiej=ejeie_ie_i = \{+1,-1,0\},\quad e_ie_j = -e_je_i

  • square any generator, replace with metric
  • swap two generators, change sign

Let's try a few examples, with two basis vectors, e1,e2\mathbf e_1,\mathbf e_2, both square to +1

3e12e1=63\mathbf e_1 2\mathbf e_1 = 6

3e12e2=6e1e2=6e123\mathbf e_1 2\mathbf e_2 = 6 \mathbf e_1\mathbf e_2 = 6 \mathbf e_{12}

(3e1+e2)e2=3e12+1(3\mathbf e_1 + \mathbf e_2) \mathbf e_2 = 3\mathbf e_{12} + 1

e2e12=e2e1e2=e1e2e2 =e1\mathbf e_2 \mathbf e_{12} = \mathbf e_2 \mathbf e_1 \mathbf e_2 = - \mathbf e_1 \mathbf e_2 \mathbf e_2  = - \mathbf e_1

e12e12=e1e2e1e2=e1e1e2e2=1\mathbf e_{12} \mathbf e_{12} = \mathbf e_1 \mathbf e_2 \mathbf e_1 \mathbf e_2 = - \mathbf e_1 \mathbf e_1 \mathbf e_2 \mathbf e_2 = -1

Geometric Algebra Vectors

in practice, only two calculation rules !  eiei={+1,1,0},eiej=ejeie_ie_i = \{+1,-1,0\},\quad e_ie_j = -e_je_i

  • square any generator, replace with metric
  • swap two generators, change sign

Let's try a few examples, with two basis vectors, e1,e2\mathbf e_1,\mathbf e_2, both square to +1

3e12e1=63\mathbf e_1 2\mathbf e_1 = 6

3e12e2=6e1e2=6e123\mathbf e_1 2\mathbf e_2 = 6 \mathbf e_1\mathbf e_2 = 6 \mathbf e_{12}

(3e1+e2)e2=3e12+1(3\mathbf e_1 + \mathbf e_2) \mathbf e_2 = 3\mathbf e_{12} + 1

e2e12=e2e1e2=e1e2e2 =e1\mathbf e_2 \mathbf e_{12} = \mathbf e_2 \mathbf e_1 \mathbf e_2 = - \mathbf e_1 \mathbf e_2 \mathbf e_2  = - \mathbf e_1

e12e12=e1e2e1e2=e1e1e2e2=1\mathbf e_{12} \mathbf e_{12} = \mathbf e_1 \mathbf e_2 \mathbf e_1 \mathbf e_2 = - \mathbf e_1 \mathbf e_1 \mathbf e_2 \mathbf e_2 = -1

Geometric Algebra Vectors

bivector rotates !

Geometric Algebra

 

We'll want more elements in the same bag, and names will get confusing, so let's first introduce some notation :

Rpositive,negative,zero\mathbb R_{positive,negative,zero}

R0,1,0\mathbb R_{0,1,0}\,\rightarrow one extra element that squares to 1-1 

R0,0,1\mathbb R_{0,0,1}\,\rightarrow one extra element that squares to 00

R9,6,0\mathbb R_{9,6,0}\,\rightarrow nine extra element that square to 11

                and six extra elements that square to 1-1

These elements are called generators, and are typically written e0,e1,e2,...\mathbf e_0, \mathbf e_1, \mathbf e_2, ...

so, only two calculation rules !  eiei={+1,1,0},eiej=ejeie_ie_i = \{+1,-1,0\},\quad e_ie_j = -e_je_i

square any generator, replace with metric
swap two generators, change sign

product of any two vectors in R3,0,0\mathbb R_{3,0,0} :

(a1e1+a2e2+a3e3)(b1e1+b2e2+b3e3)=(a_1\mathbf e_1 + a_2\mathbf e_2 + a_3\mathbf e_3)(b_1\mathbf e_1 + b_2\mathbf e_2 + b_3\mathbf e_3) =

a1b1+a2b2+a3b3+(a1b2a2b1)e12+(a1b3a3b1)e13+(a2b3a3b2)e23a_1b_1 + a_2b_2 + a_3b_3\\+ (a_1b_2-a_2b_1)\mathbf e_{12} + (a_1b_3-a_3b_1)\mathbf e_{13} + (a_2b_3-a_3b_2)\mathbf e_{23}

The product of two VECTORS is a SCALAR + BIVECTOR

aba*b == aba \cdot b ++ aba \wedge b

geometric product

inner product (dot)

outer product (wedge, 'cross')

aba*b == aba \cdot b ++ a×ba \times b

R3,0,0\mathbb R_{3,0,0}

  • 1 scalar
  • 3 vectors e1,e2,e3\mathbf e_1, \mathbf e_2, \mathbf e_3
  • 3 bivectors e12,e13,e23\mathbf e_{12}, \mathbf e_{13}, \mathbf e_{23}
  • 1 trivector e123\mathbf e_{123}

 

Scalars + Bivectors = QUATERNIONS

Geometric Algebra R3,0,0\mathbb R_{3,0,0}

RECAP :

  • Start with R\mathbb R
  • Add in some vectors eie_i - pick their metric.
  • Get free bivectors, trivectors, their metric cannot be picked.
  • an n-vector naturally contains the vectors in its name.
  • the standard product is the geometric product
  • if you only care about the 'similarity', calculate only the inner product
  • if you only care about the 'difference', calculate only the outer product
  • use scalar+bivector for transformations. (like quaternion multiplication)

Geometric Algebra

abab = geometric product

aba \cdot b = inner product

aba \wedge b = outer product

aa^* = dual of aa

aba \vee b = (ab)(a^* \wedge b^*)^*

== regressive product

abab = geometric product

aba \cdot b = inner product

aba \wedge b = outer product

aa^* = dual of aa

aba \vee b = (ab)(a^* \wedge b^*)^*

== regressive product

Geometric Algebra

We can now pick the Algebra that best fits our problem. For our current problem of computer geometry, we need it to store points, directions, lines, planes, translations and rotations.

We are now ready to create the bag we need for 2D PGA - The projective plane

2D Projective Geometric Algebra

We need a 1-up model, so start with three basis vectors :

e0,e1,e2\mathbf e_0, \mathbf e_1, \mathbf e_2

where e0\mathbf e_0 is the projective dimension. This results

in three bivectors e01,e20,e12\mathbf e_{01}, \mathbf e_{20}, \mathbf e_{12} and one trivector e012\mathbf e_{012}

remembering that we need bivectors for isometries, we consider the metric for e0\mathbf e_0

e02=+1e012=1,e202=1,e122=1{\mathbf e_0}^2 = +1 \quad \rightarrow \quad {\mathbf e_{01}}^2=-1, {\mathbf e_{20}}^2=-1, {\mathbf e_{12}}^2 = -1 

e02=1e012=+1,e202=+1,e122=1{\mathbf e_0}^2 = -1 \quad \rightarrow \quad {\mathbf e_{01}}^2=+1, {\mathbf e_{20}}^2=+1, {\mathbf e_{12}}^2 = -1

e02=0e012=0,e202=0,e122=1{\mathbf e_0}^2 = 0 \quad \rightarrow \quad {\mathbf e_{01}}^2=0, {\mathbf e_{20}}^2=0, {\mathbf e_{12}}^2 = -1

Only with e02=0\mathbf e_0^2=0 we get the two translations and one rotation we need for isometries in the 2D Euclidean plane.

We are now ready to create the bag we need for 2D PGA - The projective plane

2D Projective Geometric Algebra

We need a 1-up model, so start with three basis vectors :

e0,e1,e2\mathbf e_0, \mathbf e_1, \mathbf e_2

where e0\mathbf e_0 is the projective dimension. This results

in three bivectors e01,e20,e12\mathbf e_{01}, \mathbf e_{20}, \mathbf e_{12} and one trivector e012\mathbf e_{012}

remembering that we need bivectors for isometries, we consider the metric for e0\mathbf e_0

e02=+1e012=1,e202=1,e122=1{\mathbf e_0}^2 = +1 \quad \rightarrow \quad {\mathbf e_{01}}^2=-1, {\mathbf e_{20}}^2=-1, {\mathbf e_{12}}^2 = -1 

e02=1e012=+1,e202=+1,e122=1{\mathbf e_0}^2 = -1 \quad \rightarrow \quad {\mathbf e_{01}}^2=+1, {\mathbf e_{20}}^2=+1, {\mathbf e_{12}}^2 = -1

e02=0e012=0,e202=0,e122=1{\mathbf e_0}^2 = 0 \quad \rightarrow \quad {\mathbf e_{01}}^2=0, {\mathbf e_{20}}^2=0, {\mathbf e_{12}}^2 = -1

Only with e02=0\mathbf e_0^2=0 we get the two translations and one rotation we need for isometries in the 2D Euclidean plane.

\rightarrow elliptic 

\rightarrow hyperbolic

\rightarrow Euclidean

R2,0,1\mathbb R^*_{2,0,1}

  • 1 scalar
  • 3 vectors e0,e1,e2\mathbf e_0, \mathbf e_1, \mathbf e_2
  • 3 bivectors e01,e20,e12\mathbf e_{01}, \mathbf e_{20}, \mathbf e_{12}
  • 1 trivector e012\mathbf e_{012}

 

Scalars + Bivectors = Translate + Rotate

We are now ready to create the bag we need for 2D PGA - The projective plane 

  • e1e_1,e2e_2  represent the x=0,y=0 axis (square to +1)
  • e0e_0 for the projective axis. (squares to zero)
  • e01e_{01} and e20e_{20} square to zero, represent translations
  • e12e_{12} squares to -1, represents rotation
  • Vectors are associated to PROJECTIVE LINES
  • Bivectors are associated to PROJECTIVE POINTS
  • \wedge represents meet, \vee represents join
1 e0 e1 e2 e01 e20 e12 e012

vector

bivector

scalar

trivec

projective LINES

projective POINTS

+1 0 +1 +1 0 0 -1 0

2D Projective Geometric Algebra

R2,0,1\mathbb R^*_{2,0,1}

  • 1 scalar
  • 3 vectors e0,e1,e2\mathbf e_0, \mathbf e_1, \mathbf e_2
  • 3 bivectors e01,e20,e12\mathbf e_{01}, \mathbf e_{20}, \mathbf e_{12}
  • 1 trivector e012\mathbf e_{012}

 

Scalars + Bivectors = Translate + Rotate

We are now ready to create the bag we need for 2D PGA - The projective plane 

  • e1e_1,e2e_2  represent the x=0,y=0 axis (square to +1)
  • e0e_0 for the projective axis. (squares to zero)
  • e01e_{01} and e20e_{20} square to zero, represent translations
  • e12e_{12} squares to -1, represents rotation
  • Vectors are associated to PROJECTIVE LINES
  • Bivectors are associated to PROJECTIVE POINTS
  • \wedge represents meet, \vee represents join
1 e0 e1 e2 e01 e20 e12 e012

vector

bivector

scalar

trivec

projective LINES

projective POINTS

+1 0 +1 +1 0 0 -1 0

2D Projective Geometric Algebra

Unifies TRANSFORMATION and ELEMENT !! ex=e^\mathbf x = rotation around x\mathbf x !!

also in 3D ! "Plane based GA"

We are now ready to create the bag we need for 2D PGA - The projective plane

1 e0 e1 e2 e01 e20 e12 e012

vector

bivector

scalar

trivec

projective LINES

projective POINTS

Point at (x,y) :

Line between points p1,p2p_1, p_2 :

Line with equation ax+by+c=0a\mathbf x + b\mathbf y + c= 0 :

Intersect lines 1,2\ell_1, \ell_2 :

Rotation of α\alpha around point pp :

Translate α\alpha with infinite point pp :

Angle between lines 1,2\ell_1, \ell_2 :

Project point on line :

xe20+ye01+e12x\mathbf e_{20} + y\mathbf e_{01} + \mathbf e_{12}

p1p2p_1 \vee p_2

ae1+be2+ce0a\mathbf e_1 + b\mathbf e_2 + c\mathbf e_0

12\ell_1 \wedge \ell_2

eαpe^{\alpha p}

eαpe^{\alpha p}

cos1(12)\cos^{-1}(\ell_1 \cdot \ell_2)

(p) (\ell \cdot p) \ell

+1 0 +1 +1 0 0 -1 0

2D Projective Geometric Algebra

Now that we can multiply points and lines, lets look at some interesting products :

2D Projective Geometric Algebra

The regressive product \vee

JOINS points into lines

=P1P2           =(P1P2)\ell=P_1 \vee P_2\\\,\,\,\,\,\,\,\,\,\,\,= (P_1^* \wedge P_2^*)^*

The outer product \wedge

MEETS lines in points

P=12P=\ell_1 \wedge \ell_2

Now that we can multiply points and lines, lets look at some interesting products :

2D Projective Geometric Algebra

\ell = line (vector)

PP = point (bivector)

P\ell P = line through P,P, \perp to \ell

P\ell P\ell = reflection of PP in \ell

PPP\ell P = reflection of \ell in PP

(P)(\ell \cdot P)\ell = projection of PP on \ell

(P)P(P \cdot \ell)P = projection of \ell on PP

Now that we can multiply points and lines, lets look at some interesting products :

2D Projective Geometric Algebra

1P1\ell_1 P\ell_1 = reflection of PP in 1\ell_1

21P12\ell_2\ell_1 P\ell_1\ell_2 = reflection of PP in 1\ell_1 then 2\ell_2

 

two reflections in lines (vectors)

= rotation around intersection point (bivector)

Just like the quaternions, a transformation m=12m = \ell_1\ell_2 is applied on an element x\bf x using the "sandwich product" :

mxm~ m \mathbf x \tilde m

where m~\tilde m is the reverse of mm (here m~=21\tilde m =\ell_2 \ell_1)

Free of coordinates, chirality and insensible representations for rotations,

many algorithms trivialize. Inverse Kinematics in 4 lines, no if statements :

2D Projective Geometric Algebra

// &   = JOIN, regressive product
// >>> = SANDWICH

// c is array of PGA points in ik chain

function solveIK( c, target ) {
    for (j=0;j<4; j++) { 
    // Set end of chain to target.  
      c[l-1] = target; 
    
    // Run backwards, restore the lengths
      for (i=l-2; i>0; i--) 
        c[i] = translator(c[i]&c[i+1],-d) >>> c[i+1];
    
    // Run forwards, restore lengths again
      for (i=1; i<l; i++) 
        c[i] = translator(c[i-1]&c[i],-d) >>> c[i-1];
    }
}

Free of coordinates, chirality and insensible representations for rotations,

many algorithms trivialize. Seperating Axis test in 11 lines of code  :

2D Projective Geometric Algebra

// Seperating Axis test
// a,b are arrays of points

function sat(a,b) {
// Collect potential axis candidates
  var e=[], da=[], db=[], i, al=a.length, bl=b.length;
  for (i=0; i<al; i++) e[i]=(a[i]&a[(i+1)%al]).Normalized;
  for (i=0; i<bl; i++) e[i+al]=(b[i]&b[(i+1)%bl]).Normalized;
// Testing a single axis
  var check=(axis)=>{
    for (var i=0; i<al; i++) da[i]=(a[i]^axis).e012;
    for (var i=0; i<bl; i++) db[i]=(b[i]^axis).e012;
    return (Math.min(...da)>Math.max(...db))
         ||(Math.min(...db)>Math.max(...da));
  }
// Test all edges. Return the separating axis if found.
  for (i=0; i<e.length; i++) if (check(e[i])) return e[i];
}

It is all exactly the same in 3D, just some more elements :

3D Projective Geometric Algebra

  • Still a one-up model.
  • 4 vectors : e0,e1,e2,e3\mathbf e_0, \mathbf e_1, \mathbf e_2, \mathbf e_3 are PLANES
  • 6 bivectors : e01,e02,e03\mathbf e_{01},\mathbf e_{02},\mathbf e_{03} (translate) e12,e31,e23\mathbf e_{12}, \mathbf e_{31}, \mathbf e_{23} (rotate) are LINES
  • 4 trivectors : e021,e013,e032,e123\mathbf e_{021},\mathbf e_{013},\mathbf e_{032}, \mathbf e_{123} are POINTS
  • 1 quadvector :  e0123\mathbf e_{0123} is the PSEUDO-SCALAR
  • exponentiate Euclidean line to generate a rotation
  • exponentiate Infinite line to generate a translation
  • scalar + bivectors + quadvector are now the DUAL QUATERNIONS
  • sandwich products, reflections, incidence, .. everything stays the same !

It is all exactly the same in 3D, just some more elements :

1 e0 e1 e2 e3 e01 e02 e03

Point at (x,y,z) :

Line between points P1,P2P_1, P_2 :

Plane with equation ax+by+cz+d=0a\mathbf x + b\mathbf y + c\mathbf z + d = 0 :

Intersect planes p1,p2p_1, p_2 :

Rotation of α\alpha around line LL :

Translate α\alpha with infinite line LL :

Angle between planes p1,p2p_1, p_2 :

Project point on plane :

xe023+ye013+ze012+e123x\mathbf e_{023} + y\mathbf e_{013} + z\mathbf e_{012} + \mathbf e_{123}

P1P2P_1 \vee P_2

ae1+be2+ce3+de0a\mathbf e_1 + b\mathbf e_2 + c\mathbf e_3 + d\mathbf e_0

p1p2p_1 \wedge p_2

eαLe^{\alpha L}

eαLe^{\alpha L}

cos1(p1p2)\cos^{-1}(p_1 \cdot p_2)

(pP)p (p \cdot P) p

+1 0 +1 +1 +1 0 0 0
e12 e13 e23 e012 e013 e023 e123 e0123
scalar vector bivector trivector PSS
PROJECTIVE PLANES PROJECTIVE LINES PROJECTIVE POINTS
-1 -1 -1 0 0 0 -1 0

3D Projective Geometric Algebra

3D Projective Geometric Algebra

The regressive product \vee JOINS points or lines in lines or planes

=P1P2\ell=P_1 \vee P_2

p=P1P2P3p = P_1 \vee P_2 \vee P_3

The outer product \wedge MEETS

planes or lines in lines or points

=p1p2\ell=p_1 \wedge p_2

P=p1p2p3P = p_1 \wedge p_2 \wedge p_3

All incidence relations trivially work, and algebraic expressions with points, lines and planes can be simplified like any other.

3D Projective Geometric Algebra

The PGA motors are isomorphic to the Dual Quaternions. They can be trivially interpolated, and no matrix conversions are needed.

// >>> = SANDWICH product.
// B1, W1 = Bone1 motor and its weight
// B2, W2 = Bone2 motor and its weight
// W1 + W2 = 1

if (Dual_Quaternion) {

 // Blend motors, apply to point.
 points[i] = (w1 * b1 + w2 * b2).Normalized >>> points_orig[i];

} else {

 // Apply both motors, blend result.
 points[i] = w1 * (b1 >>> points_orig[i]) + 
             w2 * (b2 >>> points_orig[i]);

}

3D Projective Geometric Algebra

Like our torus example in the introduction, motor orbits can be used to create a wide variety of shapes using constructions known from topology

// A segment is a translation.
  SEGMENT = (BV)=>x=>1+x*BV,
// A circle as the product of a rotation and a translation.
  CIRCLE = (BV,r)=>x=>E**(PI*x*BV)*(1+r*1e01),
// A plane is the product of two segments.
  PLANE = (a,b)=>SEGMENT(a)*SEGMENT(b),
// A sphere as a product of a degenerate circle and a circle.
  SPHERE  = (r)=>CIRCLE(1e12,0)*CIRCLE(1e13,r),
// A torus as the product of two circles  
  TORUS  = (r1,r2)=>CIRCLE(1e12,r1)*CIRCLE(1e13,r2),
// A cylinder is the product of a segment and a circle
  CYLINDER = (r,h)=>CIRCLE(1e12,r)*SEGMENT(h*1e03),
// A disk is the product of a segment and (degenerate) circle
  DISK = (r)=>CIRCLE(1e13,0)*SEGMENT(1e01*r),
// and so is a cone ..
  CONE = (r,h)=>CIRCLE(1e12,0)*SEGMENT(1e01*r+1e03*h);

3D Projective Geometric Algebra

Exception free incidence calculations have many obvious applications.

// recalculate the slice. (cuts of all polies with cutplane)
var contour=[];

faces.forEach((x,i)=>{
  var [f,e1,e2,e3]=facedata[i], res=[],  
      l=(f^cut), p1=(l^e1), p2=(l^e2), p3=(l^e3),
      p12=(p1&e2).s>=0,
      p13=(p1&e3).s>=0,
      p23=(e3&p2).s>=0;
  if (p1.e123 && (p12 == p13)) res.push(p1);
  if (p2.e123 && (p12 == p23)) res.push(p2);
  if (p3.e123 && (p13 != p23)) res.push(p3);
  if (res.length==2) contour.push(res); 
})
        

3D Projective Geometric Algebra

PGA points, lines and planes are excellent for mesh vertices, edges and faces.

Edges EE and Faces FF

Ei=P1^P2^Fi=P1^P2^P3^E_i = \widehat{P_1} \vee \widehat{P_2}\quad\quad\quad F_i = \widehat{P_1} \vee \widehat{P_2} \vee \widehat{P_3}

Polygon circumference cc and area aa:

c=Eia=12Eic=\sum\lVert E_i\rVert\quad a=\frac 1 2 \lVert \sum E_i \rVert_\infty

Mesh area aa and volume vv

a=12Fiv=13Fia=\frac 1 2 \sum\lVert F_i\rVert\quad v=\frac 1 3 \lVert \sum F_i \rVert_\infty

3D Projective Geometric Algebra

PGA points, lines and planes are excellent for mesh vertices, edges and faces.

Edges EE and Faces FF

Ei=P1^P2^Fi=P1^P2^P3^E_i = \widehat{P_1} \vee \widehat{P_2}\quad\quad\quad F_i = \widehat{P_1} \vee \widehat{P_2} \vee \widehat{P_3}

for DDG, similar simple formulas :

Ωj=2πcos1(E^iE^i+1)\Omega_j = 2\pi - \sum \cos^{-1}({\widehat{E}_i\cdot \widehat{E}_{i+1}})

2πχ=Ωj2\pi\chi = \sum \Omega_j

note - no edge vectors needed ..

3D Projective Geometric Algebra

Unification of elements and transformations, makes implementing origami as easy as folding paper.


// The first three Huzita-Hatori axioms

// The fold between p1 and p2
  var Ori1 = (p1,p2)=>p1 & p2 & 1e023;

// fold p1 onto p2
  var Ori2 = (p1,p2)=>(p1&p2)<<(p1+p2).Normalized;

// fold line l1 onto line l2
  var Ori3 = (l1,l2,flag)=>{
    l1=l1.Normalized; 
    l2=l2.Normalized; 
    return flag==0?(l1+l2)&1e023:((l1+l2)<<(l1&1e023^l2))
  };

Projective Geometric Algebra - recap.

point

direction

line

plane

// construct lines
line_from_points (p1, p2)           = p1&p2 
line_from_points_and_dir (p, d)     = p&(p+d)


// construct planes
plane_from_points (p1,p2,p3)        = p1&p2&p3
plane_from_point_and_dirs (p,d1,d2) = p&(p+d1)&(p+d2)
plane_from_points_and_dir (p1,p2,d) = p1&p2&(p1+d)
plane_from_point_and_line (p,l)     = p&l 
plane_from_equation (a,b,c,d)       = ae1+be2+ce3-de0
// Intersections
intersect_line_plane (l, P)       = l^P
intersect_plane_plane (P1, P2)    = P1^P2
intersect_planes (P1, P2, P3)     = P1^P2^P3

// Projections
project_point_plane (p, P)        = P|p*P
project_line_plane (l, P)         = P|l*P
project_point_line (p, l)         = l|p*l

position

rotation

matrix

quaternion

// construct transformations -> motors, not matrices !
translate (x,y,z)             = E**(x*e01+y*e02+z*e03)
rotate_euler (h,p,b)          = E**(b*e12)*E**(p*e23)*E**(h*e13)
rotate_axis_angle (x,y,z,a)   = E**(a*x*e23+a*y*e13+a*z*e12)
look_at (from,too,pole)       = (1 + (e1-from)*(to-from))

// apply transformations -> note : all the same..
transform_point (M, p)        = M*p*~M
transform_direction (M, d)    = M*d*~M
transform_line (M, l)         = M*l*~M
transform_plane (M, P)        = M*P*~M
// construct transformations
quat_from_euler (h, p, b)
quat_from_axis_angle (x, y, z, a)
quat_look_at (from, too, pole)
quat_from_matrix (M)
quat_to_matrix (Q)

// apply transformations
transform_point (Q, p)
transform_line (Q, l)
transform_plane (Q, P)

Same as opening but now in PGA - implementation is shorter than function names !

no coordinates - no chirality - no gimbal lock - no conversions

What about performance ?

4x4 matrix multiplication : 64 multiplications, 48 additions, 16 floats

PGA motor multiplication : 48 multiplications, 40 additions, 8 floats

 

with a similar picture for the other elements :

Where is the code ?

Reference implementations for C++, C#, Python, Rust and javascript are available at :

 

https://bivector.net

 

also the place for the cheat-sheets, course notes, and the home of our forum.

Thanks !

SIGGRAPH2019 - GA for CGI

By Steven De Keninck

SIGGRAPH2019 - GA for CGI

SIGGRAPH2019 - gensub345b - Geometric Algebra for Computer Graphics

  • 8,366