   plane equation
  hi, I've been having trouble with this function:Vector v1, v2;v1 = vertices[1].v - vertices[0].v;v2 = vertices[2].v - vertices[0].v;crossProduct(&v1, &v2, &plane->normal);plane->normal.normalize();plane->dist = dotProduct(&plane->normal, &vertices[0].v);it basically converts a 3d triangle into a plane, I'm using single precision floating point for storing all of the values(plane->dist and vector position(x, y, z)). Everything works fine - almost, I've tryied and tested all functions crossProduct, dotProduct.here's my problem:Polygon p;Plane plane;Input:p.vertices[0].v(0.953384, -0.179316, 0.912878);p.vertices[1].v(1.101597, 0.245524, -1.036105);p.vertices[2].v(-0.889500, 0.160700, -1.206000);toPlane(&p, &plane);Output:plane.dist = -0.0415107plane.dist - dotProduct(&vertices[0].v, &plane->normal) = 0;plane.dist - dotProduct(&vertices[1].v, &plane->normal) = -1.49012e-008;plane.dist - dotProduct(&vertices[2].v, &plane->normal) = 72529e-009;the 3 values should be zero as they were all used to create the plane so therefore they must be coinciding with the plane, any ideas as to why this is?   
  It looks the three values are all within a reasonable range given the limits of floating-point precision.For more information, read this.   ;  I understand - the round off error is causing in inaccurate cross product vector, and then calculating the distance based on this for point A would only be correct for point A in the plane. how would I get around this, would I be better to use fixed point for storing vertices of the triangle?;Quote:Original post by staticVoid2I understand - the round off error is causing in inaccurate cross product vector, and then calculating the distance based on this for point A would only be correct for point A in the plane. how would I get around this, would I be better to use fixed point for storing vertices of the triangle?Floating point numbers have a degree of inaccuracy. In this case, -1.49012e-008 is -0.0000000149012, which is a tiny amount. You should never compare floats directly with ==, you should use an epsilon value. I.e.:if(fabs(a-b) < EPSILON) /* numbers are equal */ And chose a reasonable value for EPSILON, like 0.0000001.   ;  thanx   