File: VGetPlanes.c

package info (click to toggle)
acm 5.0-19
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,852 kB
  • ctags: 4,792
  • sloc: ansic: 42,427; makefile: 706; cpp: 293; perl: 280; sh: 198
file content (28 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Vlib.h"

VPolygon *
VGetPlanes(VPolygon * poly)
{

	VPoint    tmp[64], *p;
	int       i, lasti;

	lasti = poly->numVtces - 1;
	p = poly->vertex;

	for (i = 0; i < poly->numVtces; ++i) {
		tmp[i].x = p->y * poly->vertex[lasti].z - p->z *
			poly->vertex[lasti].y;
		tmp[i].y = p->z * poly->vertex[lasti].x - p->x *
			poly->vertex[lasti].z;
		tmp[i].z = p->x * poly->vertex[lasti].y - p->y *
			poly->vertex[lasti].x;
		lasti = i;
		p++;
	}

	for (i = 0; i < poly->numVtces; ++i)
		poly->vertex[i] = tmp[i];

	return poly;
}