fundamentals of grassmann algebra · fundamentals of grassmann algebra eric lengyel, phd terathon...
TRANSCRIPT
![Page 1: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/1.jpg)
Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software
![Page 2: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/2.jpg)
Math used in 3D programming
● Dot / cross products, scalar triple product
● Planes as 4D vectors
● Homogeneous coordinates
● Plücker coordinates for 3D lines
● Transforming normal vectors and planes with the inverse transpose of a matrix
![Page 3: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/3.jpg)
Math used in 3D programming
● These concepts often used without a complete understanding of the big picture
● Can be used in a way that is not natural
● Different pieces used separately without knowledge of the connection among them
![Page 4: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/4.jpg)
There is a bigger picture
● All of these arise as part of a single mathematical system
● Understanding the big picture provides deep insights into seemingly unusual properties
● Knowledge of the relationships among these concepts makes better 3D programmers
![Page 5: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/5.jpg)
History
● Hamilton, 1843
● Discovered quaternion product
● Applied to 3D rotations
● Not part of Grassmann algebra
![Page 6: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/6.jpg)
History
● Grassmann, 1844
● Formulated progressive and regressive products
● Understood geometric meaning
● Published “Algebra of Extension”
![Page 7: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/7.jpg)
History
● Clifford, 1878
● Unified Hamilton’s and Grassmann’s work
● Basis for modern geometric algebra and various algebras used in physics
![Page 8: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/8.jpg)
History
![Page 9: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/9.jpg)
Outline
● Grassmann algebra in 3-4 dimensions
● Wedge product, bivectors, trivectors...
● Transformations
● Homogeneous model
● Geometric computation
● Programming considerations
![Page 10: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/10.jpg)
The wedge product
● Also known as:
● The progressive product
● The exterior product
● Gets name from symbol:
● Read “a wedge b”
a b
![Page 11: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/11.jpg)
The wedge product
● Operates on scalars, vectors, and more
● Ordinary multiplication for scalars s and t:
● The square of a vector v is always zero:
0 v v
s s s v v v
s t t s st
![Page 12: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/12.jpg)
Wedge product anticommutativity
● Zero square implies vectors anticommute
0
0
0
a b a b
a a a b b a b b
a b b a
a b b a
![Page 13: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/13.jpg)
Bivectors
● Wedge product between two vectors produces a “bivector”
● A new mathematical entity
● Distinct from a scalar or vector
● Represents an oriented 2D area
● Whereas a vector represents an oriented 1D direction
● Scalars are zero-dimensional values
![Page 14: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/14.jpg)
Bivectors
● Bivector is two directions and magnitude
![Page 15: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/15.jpg)
Bivectors
● Order of multiplication matters
a b b a
![Page 16: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/16.jpg)
Bivectors in 3D
● Start with 3 orthonormal basis vectors:
● Then a 3D vector a can be expressed as
1 2 3, ,e e e
1 1 2 2 3 3a a a e e e
![Page 17: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/17.jpg)
Bivectors in 3D
1 1 2 2 3 3 1 1 2 2 3 3a a a b b b a b e e e e e e
1 2 1 2 1 3 1 3 2 1 2 1
2 3 2 3 3 1 3 1 3 2 3 2
a b a b a b
a b a b a b
a b e e e e e e
e e e e e e
2 3 3 2 2 3 3 1 1 3 3 1
1 2 2 1 1 2
a b a b a b a b
a b a b
a b e e e e
e e
![Page 18: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/18.jpg)
Bivectors in 3D
● The result of the wedge product has three components on the basis
● Written in order of which basis vector is missing from the basis bivector
2 3 3 1 1 2, , e e e e e e
![Page 19: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/19.jpg)
Bivectors in 3D
● Do the components look familiar?
● These are identical to the components produced by the cross product a × b
2 3 3 2 2 3 3 1 1 3 3 1
1 2 2 1 1 2
a b a b a b a b
a b a b
a b e e e e
e e
![Page 20: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/20.jpg)
Shorthand notation
12 1 2
23 2 3
31 3 1
123 1 2 3
e e e
e e e
e e e
e e e e
![Page 21: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/21.jpg)
Bivectors in 3D
2 3 3 2 23 3 1 1 3 31
1 2 2 1 12
a b a b a b a b
a b a b
a b e e
e
![Page 22: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/22.jpg)
Comparison with cross product
● The cross product is not associative:
● The cross product is only defined in 3D
● The wedge product is associative, and it’s defined in all dimensions
a b c a b c
![Page 23: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/23.jpg)
Trivectors
● Wedge product among three vectors produces a “trivector”
● Another new mathematical entity
● Distinct from scalars, vectors, and bivectors
● Represents a 3D oriented volume
![Page 24: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/24.jpg)
Trivectors
a b c
![Page 25: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/25.jpg)
Trivectors in 3D
● A 3D trivector has one component:
● The magnitude is
1 2 3 2 3 1 3 1 2 1 3 2 2 1 3 3 2 1
1 2 3
a b c a b c a b c a b c a b c a b c
a b c
e e e
det a b c
![Page 26: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/26.jpg)
Trivectors in 3D
● 3D trivector also called pseudoscalar or antiscalar
● Only one component, so looks like a scalar
● Flips sign under reflection
![Page 27: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/27.jpg)
Scalar Triple Product
● The product
produces the same magnitude as
but also extends to higher dimensions
a b c
a b c
![Page 28: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/28.jpg)
Grading
● The grade of an entity is the number of vectors wedged together to make it
● Scalars have grade 0
● Vectors have grade 1
● Bivectors have grade 2
● Trivectors have grade 3
● Etc.
![Page 29: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/29.jpg)
3D multivector algebra
● 1 scalar element
● 3 vector elements
● 3 bivector elements
● 1 trivector element
● No higher-grade elements
● Total of 8 multivector basis elements
![Page 30: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/30.jpg)
Multivectors in general dimension
● In n dimensions, the number of basis k-vector elements is
● This produces a nice symmetry
● Total number of basis elements always 2n
n
k
![Page 31: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/31.jpg)
Multivectors in general dimension
Dimension Graded elements
1 1 1
2 1 2 1
3 1 3 3 1
4 1 4 6 4 1
5 1 5 10 10 5 1
![Page 32: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/32.jpg)
Four dimensions
● Four basis vectors
● Number of basis bivectors is
● There are 4 basis trivectors
1 2 3 4, , ,e e e e
46
2
![Page 33: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/33.jpg)
Vector / bivector confusion
● In 3D, vectors have three components
● In 3D, bivectors have three components
● Thus, vectors and bivectors look like the same thing!
● This is a big reason why knowledge of the difference is not widespread
![Page 34: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/34.jpg)
Cross product peculiarities
● Physicists noticed a long time ago that the cross product produces a different kind of vector
● They call it an “axial vector”, “pseudovector”, “covector”, or “covariant vector”
● It transforms differently than ordinary “polar vectors” or “contravariant vectors”
![Page 35: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/35.jpg)
Cross product transform
● Simplest example is a reflection:
1 0 0
0 1 0
0 0 1
M
![Page 36: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/36.jpg)
Cross product transform
● Not the same as
1,0,0 0,1,0 0,0,1
1,0,0 0,1,0
1,0,0 0,1,0 0,0, 1
M M
0,0,1 0,0,1M
![Page 37: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/37.jpg)
Cross product transform
![Page 38: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/38.jpg)
Cross product transform
● In general, for 3 x 3 matrix M,
1 1 2 2 3 3 1 1 2 2 3 3a a a a a a M e e e M M M
1 1 2 2 3 3 1 1 2 2 3 3a a a b b b
Ma Mb
M M M M M M
![Page 39: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/39.jpg)
Cross product transform
2 3 3 2 2 3
3 1 1 3 3 1
1 2 2 1 1 2
a b a b
a b a b
a b a b
Ma Mb
M M
M M
M M
![Page 40: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/40.jpg)
Products of matrix columns
● Other dot products are zero
2 3 1
3 1 2
1 2 3
det
det
det
M M M M
M M M M
M M M M
![Page 41: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/41.jpg)
Matrix inversion
● Cross products as rows of matrix:
2 3
3 1
1 2
det 0 0
0 det 0
0 0 det
M M M
M M M M
M M M
![Page 42: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/42.jpg)
Cross product transform
● Transforming the cross product requires the inverse matrix:
2 3
13 1
1 2
det
M M
M M M M
M M
![Page 43: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/43.jpg)
Cross product transform
● Transpose the inverse to get right result:
2 3 3 2
3 1 1 3
1 2 2 1
2 3 3 2 2 3 3 1 1 3 3 1
1 2 2 1 1 2
det T
a b a b
a b a b
a b a b
a b a b a b a b
a b a b
M M
M M M M
M M
![Page 44: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/44.jpg)
Cross product transform
● Transformation formula:
● Result of cross product must be transformed by inverse transpose times determinant
det T Ma Mb M M a b
![Page 45: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/45.jpg)
Cross product transform
● If M is orthogonal, then inverse transpose is the same as M
● If the determinant is positive, then it can be left out if you don’t care about length
● Determinant times inverse transpose is called adjugate transpose
![Page 46: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/46.jpg)
Cross product transform
● What’s really going on here?
● When we take a cross product, we are really creating a bivector
● Bivectors are not vectors, and they don’t behave like vectors
![Page 47: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/47.jpg)
Normal “vectors”
● A triangle normal is created by taking the cross product between two tangent vectors
● A normal is a bivector and transforms as such
![Page 48: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/48.jpg)
Normal “vector” transformation
![Page 49: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/49.jpg)
Classical derivation
● Standard proof for inverse transpose for transforming normals:
● Preserve zero dot product with tangent
● Misses extra factor of det M
1
0
0
0T T
T
T
N T
UN MT
N U MT
U M
U M
![Page 50: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/50.jpg)
Matrix inverses
● In general, the i-th row of the inverse of M is 1/det M times the wedge product of all columns of M except column i.
![Page 51: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/51.jpg)
Higher dimensions
● In n dimensions, the (n−1)-vectors have n components, just as 1-vectors do
● Each 1-vector basis element uses exactly one of the spatial directions e1...en
● Each (n−1)-vector basis element uses all except one of the spatial directions e1...en
![Page 52: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/52.jpg)
Symmetry in three dimensions
● Vector basis and bivector (n−1) basis
1
2
3
e
e
e
2 3
3 1
1 2
e e
e e
e e
![Page 53: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/53.jpg)
Symmetry in four dimensions
● Vector basis and trivector (n−1) basis
2 3 4
1 4 3
1 2 4
1 3 2
e e e
e e e
e e e
e e e
1
2
3
4
e
e
e
e
![Page 54: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/54.jpg)
Dual basis
● Use special notation for wedge product of all but one basis vector:
1 2 3 4
2 1 4 3
3 1 2 4
4 1 3 2
e e e e
e e e e
e e e e
e e e e
![Page 55: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/55.jpg)
Dual basis
● Instead of saying (n−1)-vector, we call these “antivectors”
● In n dimensions, antivector always means a quantity expressed on the basis with grade n−1
![Page 56: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/56.jpg)
Vector / antivector product
● Wedge product between vector and antivector is the origin of the dot product
● They complement each other, and “fill in” the volume element
1 1 2 2 3 3 1 1 2 2 3 3
1 1 2 2 3 3 1 2 3
a a a b b b
a b a b a b
e e e e e e
e e e
![Page 57: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/57.jpg)
Vector / antivector product
● Many of the dot products you take are actually vector / antivector wedge products
● For instance, N • L in diffuse lighting
● N is an antivector
● Calculating volume of extruded bivector
![Page 58: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/58.jpg)
Diffuse Lighting
![Page 59: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/59.jpg)
The regressive product
● Grassmann realized there is another product symmetric to the wedge product
● Not well-known at all
● Most books on geometric algebra leave it out completely
● Very important product, though!
![Page 60: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/60.jpg)
The regressive product
● Operates on antivectors in a manner symmetric to how the wedge product operates on vectors
● Uses an upside-down wedge:
● We call it the “antiwedge” product
1 2e e
![Page 61: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/61.jpg)
The antiwedge product
● Has same properties as wedge product, but for antivectors
● Operates in complementary space on dual basis or “antibasis”
![Page 62: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/62.jpg)
The antiwedge product
● Whereas the wedge product increases grade, the antiwedge product decreases it
● Suppose, in n-dimensional Grassmann algebra, A has grade r and B has grade s
● Then has grade r + s
● And has grade
n − (n − r) − (n − s) = r + s − n
A B
A B
![Page 63: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/63.jpg)
Antiwedge product in 3D
1 2 2 3 3 1 3
2 3 3 1 1 2 1
3 1 1 2 2 3 2
e e e e e e e
e e e e e e e
e e e e e e e
![Page 64: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/64.jpg)
Similar shorthand notation
12 1 2
23 2 3
31 3 1
123 1 2 3
e e e
e e e
e e e
e e e e
![Page 65: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/65.jpg)
Join and meet
● Wedge product joins vectors together
● Analogous to union
● Antiwedge product joins antivectors
● Antivectors represent absence of geometry
● Joining antivectors is like removing vectors
● Analogous to intersection
● Called a meet operation
![Page 66: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/66.jpg)
Homogeneous coordinates
● Points have a 4D representation:
● Conveniently allows affine transformation through 4 x 4 matrix
● Used throughout 3D graphics
, , ,x y z wP
![Page 67: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/67.jpg)
Homogeneous points
● To project onto 3D space, find where 4D vector intersects subspace where w = 1
3D
, , ,
, ,
x y z w
x y z
w w w
P
P
![Page 68: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/68.jpg)
Homogeneous model
● With Grassmann algebra, homogeneous model can be extended to include 3D points, lines, and planes
● Wedge and antiwedge products naturally perform union and intersection operations among all of these
![Page 69: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/69.jpg)
4D Grassmann Algebra
● Scalar unit
● Four vectors:
● Six bivectors:
● Four antivectors:
● Antiscalar unit (quadvector)
1 2 3 4, , ,e e e e
12 23 31 41 42 43, , , , ,e e e e e e
1 2 3 4, , ,e e e e
![Page 70: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/70.jpg)
Homogeneous lines
● Take wedge product of two 4D points
1 2 3 4, , ,1x y z x y zP P P P P P P e e e e
1 2 3 4, , ,1x y z x y zQ Q Q Q Q Q Q e e e e
![Page 71: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/71.jpg)
Homogeneous lines
● This bivector spans a 2D plane in 4D
● In subspace where w = 1, this is a 3D line
41 42 43
23 31 12
x x y y z z
y z z y z x x z x y y x
Q P Q P Q P
P Q P Q P Q P Q P Q P Q
P Q e e e
e e e
![Page 72: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/72.jpg)
Homogeneous lines
● The 4D bivector no longer contains any information about the two points used to create it
● Contrary to parametric origin / direction representation
![Page 73: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/73.jpg)
Homogeneous lines
● The 4D bivector can be decomposed into two 3D components:
● A tangent vector and a moment bivector
● These are perpendicular
41 42 43
23 31 12
x x y y z z
y z z y z x x z x y y x
Q P Q P Q P
P Q P Q P Q P Q P Q P Q
P Q e e e
e e e
![Page 74: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/74.jpg)
Homogeneous lines
● Tangent T vector is
● Moment M bivector is
3D 3DQ P
3D 3DP Q
41 42 43
23 31 12
x x y y z z
y z z y z x x z x y y x
Q P Q P Q P
P Q P Q P Q P Q P Q P Q
P Q e e e
e e e
![Page 75: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/75.jpg)
Moment bivector
![Page 76: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/76.jpg)
Plücker coordinates
● Origin of Plücker coordinates revealed!
● They are the coefficients of a 4D bivector
● A line L in Plücker coordinates is
● A bunch of seemingly arbitrary formulas in Plücker coordinates will become clear
: L Q P P Q
![Page 77: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/77.jpg)
Homogeneous planes
● Take wedge product of three 4D points
1 2 3 4, , ,1x y z x y zP P P P P P P e e e e
1 2 3 4, , ,1x y z x y zQ Q Q Q Q Q Q e e e e
1 2 3 4, , ,1x y z x y zR R R R R R R e e e e
![Page 78: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/78.jpg)
Homogeneous planes
● N is the 3D normal bivector
● D is the offset from origin in units of N
1 2 3 4x y zN N N D P Q R e e e e
3D 3D 3D 3D 3D 3D
3D 3D 3DD
N P Q Q R R P
P Q R
![Page 79: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/79.jpg)
Plane transformation
● A homogeneous plane is a 4D antivector
● It transforms by the inverse of a 4 x 4 matrix
● Just like a 3D antivector transforms by the inverse of a 3 x 3 matrix
● Orthogonality not common here due to translation in the matrix
![Page 80: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/80.jpg)
Projective geometry
● We always project onto the 3D subspace where w = 1
4D Entity 3D Geometry
Vector (1-space) Point (0-space)
Bivector (2-space) Line (1-space)
Trivector (3-space) Plane (2-space)
![Page 81: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/81.jpg)
Geometric computation in 4D
● Wedge product
● Multiply two points to get the line containing both points
● Multiply three points to get the plane containing all three points
● Multiply a line and a point to get the plane containing the line and the point
![Page 82: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/82.jpg)
Geometric computation in 4D
● Antiwedge product
● Multiply two planes to get the line where they intersect
● Multiply three planes to get the point common to all three planes
● Multiply a line and a plane to get the point where the line intersects the plane
![Page 83: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/83.jpg)
Geometric computation in 4D
● Wedge or antiwedge product
● Multiply a point and a plane to get the signed minimum distance between them in units of the normal magnitude
● Multiply two lines to get a special signed crossing value
![Page 84: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/84.jpg)
Product of two lines
● Wedge product gives an antiscalar (quadvector or 4D volume element)
● Antiwedge product gives a scalar
● Both have same sign and magnitude
● Grassmann treated scalars and antiscalars as the same thing
![Page 85: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/85.jpg)
Product of two lines
● Let L1 have tangent T1 and moment M1
● Let L2 have tangent T2 and moment M2
● Then,
1 2 1 2 2 1 L L T M T M
1 2 1 2 2 1 L L T M T M
![Page 86: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/86.jpg)
Product of two lines
● The product of two lines gives a “crossing” relation
● Positive value means clockwise crossing
● Negative value means counterclockwise
● Zero if lines intersect
![Page 87: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/87.jpg)
Crossing relation
![Page 88: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/88.jpg)
Distance between lines
● Product of two lines also relates to signed minimum distance between them
● (Here, numerator is 4D antiwedge product, and denominator is 3D wedge product.)
1 2
1 2
d
L L
T T
![Page 89: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/89.jpg)
Ray-triangle intersection
● Application of line-line product
● Classic barycentric calculation difficult due to floating-point round-off error
● Along edge between two triangles, ray can miss both or hit both
● Typical solution involves use of ugly epsilons
![Page 90: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/90.jpg)
Ray-triangle intersection
● Calculate 4D bivectors for triangle edges and ray
● Take antiwedge products between ray and three edges
● Same sign for all three edges is a hit
● Impossible to hit or miss both triangles sharing edge
● Need to handle zero in consistent way
![Page 91: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/91.jpg)
Weighting
● Points, lines, and planes have “weights” in homogeneous coordinates
Entity Weight
Point w coordinate
Line Tangent component T
Plane x, y, z component
![Page 92: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/92.jpg)
Weighting
● Mathematically, the weight components can be found by taking the antiwedge product with the antivector (0,0,0,1)
● We would never really do that, though, because we can just look at the right coefficients
![Page 93: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/93.jpg)
Normalized lines
● Tangent component has unit length
● Magnitude of moment component is perpendicular distance to the origin
![Page 94: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/94.jpg)
Normalized planes
● (x,y,z) component has unit length
● Wedge product with (normalized) point is perpendicular distance to plane
![Page 95: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/95.jpg)
Programming considerations
● Convenient to create classes to represent entities of each grade
● Vector4D
● Bivector4D
● Antivector4D
![Page 96: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/96.jpg)
Programming considerations
● Fortunate happenstance that C++ has an overloadable operator ^ that looks like a wedge
● But be careful with operator precedence if you overload ^ to perform wedge product
● Has lowest operator precedence, so get used to enclosing wedge products in parentheses
![Page 97: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/97.jpg)
Combining wedge and antiwedge
● The same operator can be used for wedge product and antiwedge product
● Either they both produce the same scalar and antiscalar magnitudes with the same sign
● Or one of the products is identically zero
● For example, you would always want the antiwedge product for two planes because the wedge product is zero for all inputs
![Page 98: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/98.jpg)
Summary
Old school New school
Cross product axial vector Wedge product bivector
Dot product Antiwedge vector / antivector
Scalar triple product Triple wedge product
Plücker coordinates 4D bivectors
Operations in Plücker coordinates 4D wedge / antiwedge products
Transform normals with inverse transpose
Transform antivectors with adjugate transpose
![Page 100: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/100.jpg)
Supplemental Slides
![Page 101: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/101.jpg)
Example application
● Calculation of shadow region planes from light position and frustum edges
● Simply a wedge product
![Page 102: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/102.jpg)
Points of closest approach
● Wedge product of line tangents gives complement of direction between closest points
![Page 103: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/103.jpg)
Points of closest approach
● Plane containing this direction and first line also contains closest point on second line
![Page 104: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/104.jpg)
Two dimensions
● 1 scalar unit
● 2 basis vectors
● 1 bivector / antiscalar unit
● No cross product
● All rotations occur in plane of 1 bivector
![Page 105: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/105.jpg)
One dimension
● 1 scalar unit
● 1 single-component basis vector
● Also antiscalar unit
● Equivalent to “dual numbers”
● All numbers have form a + be
● Where e2 = 0
![Page 106: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/106.jpg)
Explicit formulas
● Define points P, Q and planes E, F, and line L
1 2 3 4, , ,1x y z x y zP P P P P P P e e e e
1 2 3 4, , ,1x y z x y zQ Q Q Q Q Q Q e e e e
1 2 3 4, , ,x y z w x y z wE E E E E E E E E e e e e
1 2 3 4, , ,x y z w x y z wF F F F F F F F F e e e e
41 42 43 23 31 12x y z x y zT T T M M M L e e e e e e
![Page 107: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/107.jpg)
Explicit formulas
● Product of two points
41 42 43
23 31 12
x x y y z z
y z z y z x x z x y y x
Q P Q P Q P
P Q P Q P Q P Q P Q P Q
P Q e e e
e e e
![Page 108: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/108.jpg)
Explicit formulas
● Product of two planes
41 42 43
23 31 12
z y y z x z z x y x x y
x w w x y w w y z w w z
E F E F E F E F E F E F
E F E F E F E F E F E F
E F e e e
e e e
![Page 109: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/109.jpg)
Explicit formulas
● Product of line and point
1 2
3 4
y z z y x z x x z y
x y y x z x x y y z z
T P T P M T P T P M
T P T P M P M P M P M
L P e e
e e
![Page 110: Fundamentals of Grassmann Algebra · Fundamentals of Grassmann Algebra Eric Lengyel, PhD Terathon Software . Math used in 3D programming ... insights into seemingly unusual properties](https://reader030.vdocuments.us/reader030/viewer/2022013120/5b04532f7f8b9a0a548d6237/html5/thumbnails/110.jpg)
Explicit formulas
● Product of line and plane
1 2
3 4
z y y z x w x z z x y w
y x x y z w x x y y z z
M E M E T E M E M E T E
M E M E T E E T E T E T
L E e e
e e