   rending VMF solids
  Hi there, I'm having some problems rendering solids loaded from a VMF (Valve Map Format, the Hammer editors raw uncompiled map format)I've been using a paper called ".MAP files file format description, algorithms, and code" By Stefan Hajnoczi  (http://mattn.ninex.info/files/MAPFiles.pdf).Because the sides of a soild in a vmf file are stored as planes the idea is to intersect all the panes together in threes, either the planes are parallel and don't intersect, or we get a vertex from there intersection. Then we test that vertex to see if its in front of any of the planes, if it is that means its outside the shape.That's the basics of the algorithm described in that paper, and I converted the papers pseudo code in to c#/xna. It half works, I'm getting all the points in the shape, but not in the correct ploys.heres an example of its output for a really simple VMF file ( a single cube that 128x128x64, but I scale the verts by 128 when i add them to the polygon.[0]: {Poly: {X:-0.5 Y:0.5 Z:0.5} {X:0.5 Y:0.5 Z:0.5}}[1]: {Poly: {X:0.5 Y:0 Z:0.5} {X:-0.5 Y:0 Z:0.5} {X:0.5 Y:0 Z:-0.5}}[2]: {Poly: {X:-0.5 Y:0 Z:0.5} {X:-0.5 Y:0.5 Z:0.5} {X:0.5 Y:0 Z:-0.5}}[3]: {Poly: {X:0.5 Y:0.5 Z:0.5} {X:-0.5 Y:0 Z:0.5} {X:-0.5 Y:0.5 Z:-0.5} {X:0.5 Y:0 Z:0.5}}[4]: {Poly: {X:-0.5 Y:0.5 Z:0.5} {X:-0.5 Y:0 Z:-0.5} {X:0.5 Y:0 Z:0.5} {X:0.5 Y:0.5 Z:-0.5} {X:-0.5 Y:0 Z:0.5} {X:0.5 Y:0.5 Z:0.5}}[5]: {Poly:}As you can see, something must be broken, or I'm not understanding how this algorithm is supposed to work (i expected to get 4 verts in each polygon.)So, any ideas how this might be happening? below is my implementation of the code, id imagine I've made a silly mistake and I just keep missing it when i go over my code.for (int i = 0; i < planes.Count - 1; i++)  { for (int j = 0; j < planes.Count - 1; j++) {for (int k = 0; k < planes.Count - 1; k++){    if (i!=j && i != k && j != k)    {   bool illegal = false;    Vector3 p;   if (GetIntersection(planes.Normal, planes[j].Normal, planes[k].Normal, planes.D, planes[j].D, planes[k].D, out p))   {  for (int m = 0; m < planes.Count - 1; m++)  {  float f = Vector3.Dot(planes[m].Normal, p) + planes[m].D; if (f > 0f)illegal = true;  }  if (illegal == false)  { polys.AddVertex(p);  }   }    }} }  }private bool GetIntersection (Vector3 n1, Vector3 n2, Vector3 n3, float d1, float d2, float d3, out Vector3 p)    {   float denom = Vector3.Dot(n1,Vector3.Cross(n2,n3));  if (denom == 0f)  { p = Vector3.Zero; return false;  }    p = -d1 * Vector3.Cross(n2,n3) - d2 * Vector3.Cross(n3,n1) - d3 * Vector3.Cross(n1,n2)/denom;    return true;   }