I am trying to convert .map file brushes (quake, hl) into models. The data of a brush, which is just a shape in the editor, is given as a bunch of planes, each being defined by 3 points (each with x,y,z). It is the intersection of any 3 planes that give you the actual vertex points of the shape (for those that do intersect).

I am trying to use this page

http://mathworld.wolfram.com/Plane-PlaneIntersection.html to achieve it, but I cannot get it to work.

This is the formula from that page:

I have been told the first part (the bit to the negative 1) is calculated by:

dotProduct [normal1, crossProduct (normal2, normal3 ) ]; does anyone know if this is correct?

Second, these normals for each plane, I have been calculating these:

For 3 points, p1, p2, p3

cross( (p2 - p1), (p3-p1) );

After this I normalize them.

Finally, in that formula, is the x1, x2, x3 simply one of my 3 points for each plane?

Would be really grateful if anyone who knows this math could clarify those points for me. Alternatively if anyone knows of any code that finds the intersection of 3 planes when it exists, that would be awesome