   rendering planes with lines for debugging.
  Anyone got a simple function that render planes with lines or someting that can be used to see that the planes are correct? Or even better, a function that calculate plane intersectionpoints and renders a frustum.Thanks in advance!   
  That depends on your graphics API. And you can't render planes with lines, since planes have infinite area - there's no edges to draw. If you know the extents of the plane (So it's a quad, really), you can draw lines around that.   ;Quote:Original post by peter_bAnyone got a simple function that render planes with lines or someting that can be used to see that the planes are correct? Or even better, a function that calculate plane intersectionpoints and renders a frustum.Thanks in advance!I usually render planes (for debugging purposes) as a grid, but it sounds like what you really want is to render the volume of a view frustum.The key thing you need for this is a plane intersection function, as you mentioned. The algorithm is straightforward, and is simply the solution to a 3x3 system of equations, where each equation represents one of the three planes. Note that there are various configurations (all planes parallel, two planes parallel, and so on) where the system has no solution or no unique solution, but when intersecting the planes of a frustum you should not encounter these situations under normal circumstances.Here's some code (note that the input planes are in ax+by+cz+d = 0 form):template <class T> bool intersect_planes(T p0[4], T p1[4], T p2[4], Vector3<T>& v, T epsilon){    Vector3<T> n0(p0[0], p0[1], p0[2]);    Vector3<T> n1(p1[0], p1[1], p1[2]);    Vector3<T> n2(p2[0], p2[1], p2[2]);   T d0 = -p0[3];    T d1 = -p1[3];    T d2 = -p2[3];   T denom = no.Dot(n1.Cross(n2));    if (Math<T>::Fabs(denom) < epsilon)   return false;    v = (d0 * n1.Cross(n2) + d1 * n2.Cross(n0) + d2 * n0.Cross(n1)) / denom;    return true;}