# What's the purpose of this cross product and dot product in triangle clipping code?

I have this code that inserts a triangle into the drawing list. The PHD_VBUF structure stores one x,y,z vertex. If the vertex is behind the front plane, then clip = -128 at that vertex. That is, if the vertex has clip < 0, then visible_zclip() is called, but I don’t understand what the function does.

It finds the normal to the polygon - the cross product of vertices 1 and 3. Then it determines on which side of this polygon vertex 2 lies. So what? I can't understand. What can we learn from knowing whether vertex 2 is in front of the plane or behind this plane?

// Code inserts or reject a triangle into the drawing list
// (Here we have a quad with four vertices)
if ((pV1->clip|pV2->clip|pV3->clip|pV4->clip)<0)
{
if (!visible_zclip(pV1,pV2,pV3))
return; //skip the triangle

// More code, also handling the other triangle in the quad...

int visible_zclip(PHD_VBUF *vn1, PHD_VBUF *vn2, PHD_VBUF *vn3)
{
// Cross product of point 1 and 3 with the origin to get plane through origin,
// then see which side of this plane point 2 lies on
float a,b,c;

a = (vn1->yv * vn3->zv) - (vn3->yv * vn1->zv);
b = (vn1->zv * vn3->xv) - (vn3->zv * vn1->xv);
c = (vn1->xv * vn3->yv) - (vn3->xv * vn1->yv);

if ((a * vn2->xv) + (b * vn2->yv) + (c * vn2->zv) < 0.0f)
return(1);

return(0);
}