Projective geometric algebra
Points, lines, and homogeneous scale
The first layer of 2D projective geometric algebra is a reliable way to talk about points, lines, incidence, and location without switching coordinate models. This article builds that layer using the same ganja.js PGA convention used throughout the 2D pages.
The first projective rule is that coordinates are representatives of an object. A point or line can be multiplied by any nonzero scalar and still name the same geometry. The raw numbers change; the incidence relationships stay fixed.
We will use ganja's plane-based PGA convention, Algebra(2,0,1). In this convention a 2D line is a grade-1 vector, a finite 2D point is a grade-2 bivector, and e0 is the null basis direction from the degenerate metric slot. The 2D pages use this convention consistently, soe0, e1, e2, and their blade products always refer to this basis.
Lines First
In ordinary analytic geometry, a line can be written as ax + by + c = 0. In this PGA model, that same line is represented as the vector
line = a e1 + b e2 + c e0The e1 and e2 components give the Euclidean normal direction of the line. The e0 component is the offset term. If a and bform a unit vector, then ax + by + c is a signed distance. With any other nonzero scale, the same expression is a valid incidence test with an arbitrary numeric scale.
Points Are Bivectors
A finite point at ordinary coordinates (x, y) is represented as a bivector:
P = e12 - x e02 + y e01The e12 coefficient is the homogeneous weight. The e01 and e02 coefficients contain position, but they only become ordinary coordinates after we divide by that weight:
x = -P.e02 / P.e12
y = P.e01 / P.e12Homogeneous coordinates represent the point through ratios. The normalized chart coordinates come from dividing by the weight.
Scalar Multiples Represent The Same Object
If P is a point, then 2P, 0.5P, and 37P represent the same point. If line represents a line, then 3 * line represents the same line. The exception is multiplying by zero, because zero destroys the representative entirely.
This is homogeneity. Raw component values can be misleading when only representative scale changes. The projective object stays fixed. All nonzero representatives lie on the same projective ray, and the affine chart intersection stays fixed.
Normalization Is A Display Choice
PGA keeps the raw representative available, while a display usually needs a stable representative to read. The raw and normalized representatives are both useful. Normalization chooses a convenient representative of the same point or line before chart coordinates are reported.
For a finite point, the most useful display normalization is to divide by P.e12. That makes the homogeneous weight equal to 1, so the remaining point components tell us ordinary coordinates immediately. Representative scale changes the raw coefficients, while the normalized point representative stays fixed.
For a line, a useful display normalization is to divide by the Euclidean length of its normal:
length = Math.hypot(line.e1, line.e2)
normalizedLine = line / lengthAfter that, the e0 coefficient is an actual signed offset from the origin, and normalizedLine.e1 * x + normalizedLine.e2 * y + normalizedLine.e0 is a signed distance. Changing only the line scale leaves the normalized line fixed.
The First Incidence Test
The wedge product gives us a first useful test:
incidence = P ^ lineIn this 2D case, the result lands in the pseudoscalar component e012. When the point lies on the line, that component is zero. The raw incidence value also scales with the point and line representatives. Dividing by the point weight and the line normal length gives the normalized incidence: the signed distance from the point to the line.
Use PGA operations for the geometry, then choose a normalized representative when the result needs to be inspected. The next article uses the same convention for meet and join.