Monday, January 19, 2009

Planes in ODE

The ODE documentation is quite lacking. Since it's a wiki I'll probably help to improve it as I use it but for anyone who wants to better understand ODE's Plane geometry, here you go:

The plane geometry is, well, a plane. But it's not really, it's actually a half-space, which means that stuff on the "solid" side of the plane is ejected out violently toward the "empty" side. To specify a plane you use the basic plane formula:

Ax + By + Cz = D

If you've had a math class that covered it, great, I bet you know how this works. For those that haven't, (A,B,C) is the normal vector (or unit vector) of the plane, and D is the distance from the origin along that normal. Now, the open side of the plane is on the positive (larger) side of the normal, ie the side of the plane that the normal would point to if it was, in fact, an actual arrow.

To illustrate this point, here are some axis-aligned planes and an explanation of which side is open and which is closed:

Plane (1, 0, 0, 0) is aligned to the X axis, with positive X values being in the open side. The plane (-1, 0, 0, 0) is also aligned to the X axis, but conversely the negative X values are in the open side of the half space.

Likewise, (0, 0, 1, 0) is aligned Z, with the open side on the positive side. To have the other half of the plane open, it is (0, 0, -1, 0).

The opposite portion of the half space of any given plane can be defined as the opposite of it's formula, for instance both of the following planes are on the same line but specify the opposite portion of the plane as the open space: (123, 456, -789, 10) and (-123, -456, 789, -10) (although ODE won't like these as the vector (A,B,C) should be normalized to a length of 1-- just illustrating the point).

Sure, most of this is pretty straightforward but the documentation is completely lacking in the fundamental information, hardly making a mention of the slightly deceptive nature of it's name (it's called Plane but it's actually a half-space). Maybe this will help the next maths-deficient ODE user to not waste time playing with planes to understand their construction and behavior. Unless you still want to. It can be fun.

No comments: