"Which side of this plane is my point on?" and other comparisons in PGA
Yay, more obscure PGA facts!
Here are the formulae we’ll be discussing - they are ordered by how elegant I think they are!
point_which_side_of_plane = (p,P) => sign( (P^p)[15] )
//[15] is e0123’s coefficient
line_piercing_from_which_side_of_plane = (P,L) => sign( (P^L)[14] )
//[14] is e123’s coefficient
lines_parallel_or_antiparallel = (L1,L2) => sign( (L1·L2)[0] )
//[0] is scalar coefficient
lines_crossingness = (L1,L2) => sign( (L1^L2)[15] )
ideal_point_which_side_of_ideal_line = (p,L) => from_which_side_does_line_pierce_plane(p*,L*)
parallel_line_which_side_of_plane =
(L,P) => {
p = (e123·L)/L //origin point projected on L
return point_which_side_of_plane(p,P)
}
Ideally, you should know how to think about all of these in terms of transformations. The geometric product of any two geometric objects a transformation that takes you from one towards the other, and is a composition of the two transformations that the objects represent. A line is 180 turn; a plane is a planar reflection; a point is a point reflection. The wedge product “^” and the inner product “·” are just parts of the geometric product.
For example, the point_which_side_of_plane
example is about the handedness/distance of a screw motion, because a planar reflection followed by a point reflection is a screw motion (the rotation is 180 degrees). This is also what happens with the line-line situation: you’re considering a 180 around L1 followed by a 180 around L2, which is a screw motion, and you’re asking “what distance does this screw motion take me by, when compared with how much it rotates me?”. There’s an alternative way to take point_which_side_of_plane
, which is sign( (P&p)[0] )
, with “&
” being the regressive product. This is kind of nice because it feels like it’s related to euclidean volume. I’m not so convinced by it though; the transform compositions seem more insightful to me.
These are all binary questions, but under the hood are continuous. All of them have a “0” case, which is stuff like “that point is actually embedded in your plane” or “those lines are at 90 degrees to each other”. Also note there’s no way to answer the question “which side of point A is point B on?” - at least not in euclidean space 🙂
A glimpse of something deep
It must be said that there is something a bit cheap taking place involving lines. Consider this picture:
I’ve never needed this myself, but it’s nice to have. However, the kinds of lines I tend to think about do not have arrows going along them, instead they have arrows going around them. Here’s a comparison:
These are two qualitatively different kinds of line, but they both get represented by the same thing when we do ordinary PGA. There are attempts to fix this with CGA and with Charles Gunn’s “Bit Better” approach; both involve managing more algebra and geometry, which not everyone wants to do, but hey, it might be important.
Our functions above don’t seem affected; but, this stuff does point to strangeness for our line_piercing_from_which_side_of_plane
function.
To see this, we first want to think about rotoreflections. An example of a rotoreflection would be 0.8e1+0.6e123 = e1(0.8+0.6e23). The sign of the e123 component of that rotoreflection (positive) tells you about how the rotation component of it, which is 0.8+0.6e23, relates to the reflection component of it, which is the planar reflection e1. Take your right hand, and point your thumb in the direction that e1 is facing in; if the fingers of your right hand curl in the direction that (0.8+0.6e23) rotates, then we might say it’s are right handed rotoreflection; otherwise, left handed. Right handed will be positive e123, left handed negative e123. We could have made different choices in our basis about all that by the way - we could have stored pointed e1 in the other direction. But basis in literally in our hands, we can get definitive answers like this. When we want them, that is! If you find it boring or difficult or just tiresome to think about this stuff, it’s no negative reflection on you (😀).
So; we wanted line_piercing_from_which_side_of_plane
; from “in front” or “behind”. Again your line is a 180 turn, and your plane is a reflection. Their transform composition will be a rotoreflection. The handedness of your rotoreflection gives you an answer, and the case where the line sits in the plane, or in fact any time it is parallel to it, you’ll get no sign. That’s what we wanted - although, we didn’t think about it by using an “along” line”, we instead used an “around” line.
Relatedly, I have tried three times now to think of a more elegant/efficient formula for parallel_line_which_side_of_plane
. It’s really weird we have to resort to projection in that one case, since you get a perfectly respectable transformation from composing a parallel line and plane (a transflection). Taniwha reckons (paraphrasing…) that it’s because the choice of handedness in one’s basis must be brought to bear, and bringing in e123 does this.