-#include <GL/gl.h>
-
-/* Normalise a vector */
-static void
-normalize (XYZ *p)
-{
- double length;
- length = sqrt(p->x * p->x + p->y * p->y + p->z * p->z);
- if (length != 0) {
- p->x /= length;
- p->y /= length;
- p->z /= length;
- } else {
- p->x = 0;
- p->y = 0;
- p->z = 0;
- }
-}
-
-
-/* Calculate the unit normal at p given two other points
- p1,p2 on the surface. The normal points in the direction
- of p1 crossproduct p2
- */
-static void
-do_plane_normal (XYZ p, XYZ p1, XYZ p2)
-{
- XYZ n, pa, pb;
- pa.x = p1.x - p.x;
- pa.y = p1.y - p.y;
- pa.z = p1.z - p.z;
- pb.x = p2.x - p.x;
- pb.y = p2.y - p.y;
- pb.z = p2.z - p.z;
- n.x = pa.y * pb.z - pa.z * pb.y;
- n.y = pa.z * pb.x - pa.x * pb.z;
- n.z = pa.x * pb.y - pa.y * pb.x;
- normalize (&n);
- glNormal3f (n.x, n.y, n.z);
-}
-