# Geometric product calculation

I’m starting to try and get my head around (E)PGA in 2D, and as a start I’m trying to evaluate the geometric product for two points. I’ve seen eg here that the product is ab = a · b + a ∧ b, but when I try to evaluate that with ganja.js:

// Create a Clifford Algebra with 2,0,1 metric.
Algebra(2,0,1,()=>{
var a = (1e01 + 1e20 + 1e12);
var b = (1e01 + 2e20 + 1e12);
var ab1 = a * b;
var ab2 = (a << b) + (a ^ b);
document.body.innerHTML = "<div>"+ab1+"</div><div>"+ab2+"</div>";
});


the output doesn’t match:

 -1-e_01
-1


Do these operators have different definitions or am I just missing something obvious?

That’s not the definition of geometric product, it’s only a special case for when an input is a vector. In general, the formula is not valid, and since neither of your input is a vector, the formula doesn’t apply.

@chakravala is right, that definition is valid for two 1-vectors. But since in 2D EPGA points are 2-vectors (as in your code), then this formula is no longer valid. The correct one can be found on the SIGGRAPH course notes in Sec. 7.2: \textbf{P}\textbf{Q} = = -1 + d_{PQ}\textbf{V} , where \textbf{V} is an ideal point (a 2-vector satisfying \textbf{V}\cdot\textbf{V}=0) perpendicular to the line joining \textbf{P} and \textbf{Q}. Assuming \bf{V} is normalized in the ideal norm (\| \textbf{V}\|_\infty = 1), then the coefficient d_{PQ} is the distance between the two points.

In other words: \textbf{P} \cdot \textbf{Q}, the grade-0 part of the geometric product of two normalized euclidean points is always -1, and the grade-2 part (also written \vec{P}\times\vec{Q} since it’s the commutator PQ-QP) is an ideal point perpendicular to the direction \bf P-Q. Its ideal norm is the distance between the points.

I recommend if you are just starting to explore 2D EPGA to begin with lines (the 1-vectors, where the formula you quoted is valid) and move up to points (2-vectors) after you’re comfortable with lines. That way you move from the more familiar to the less familiar.

2 Likes

Thank you both, that clears up my misconception. I hadn’t realised that calculating the geometric product of two multivectors is just multiplying out the terms normally, that’s much simpler than I expected. And thanks again @cgunn3 for explaining what the result of multiplying two points means geometrically, that was likely going to be my next question!