Category : C Source Code
Archive   : GRAFGEM2.ZIP
Filename : FASTUPDA.C

 
Output of file : FASTUPDA.C contained in archive : GRAFGEM2.ZIP

/*
* Author: Filippo Tampieri
*/

#define FALSE 0
#define TRUE 1
#define DOT(A,B) (A[0] * B[0] + A[1] * B[1] + A[2] * B[2])

/*
vertexIsBehindPlane returns TRUE if point P is behind the
plane of normal N and coefficient d, FALSE otherwise.
*/
vertexIsBehindPlane(P, N, d)
float P[3], N[3], d;
{
return(DOT(N, P) + d <= 0. ? TRUE : FALSE);
}

/*
boxIsBehindPlane returns TRUE if the axis-aligned box of
minimum corner Cmin and maximum corner Cmax is behind the
plane of normal N and coefficient d, FALSE otherwise.
*/
boxIsBehindPlane(Cmin, Cmax, N, d)
float Cmin[3], Cmax[3], N[3], d;
{
register int i;
float P[3];

/*
assign to P the corner further away
along the direction of normal N
*/
for(i = 0; i < 3; i++)
P[i] = N[i] >= 0. ? Cmax[i] : Cmin[i];

/* test P against the input plane */
return(vertexIsBehindPlane(P, N, d));
}






  3 Responses to “Category : C Source Code
Archive   : GRAFGEM2.ZIP
Filename : FASTUPDA.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/