All pastes #729817 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-10-08 12:43 UTC
rendered paste body
Is point P inside?

if P.y > 0.5 || P.y < -0.5 return FALSE;

int num = s->hsize * cs->nOutput;

for (i = 0; i < num; i++)
{
	float ang = (360 / num) * i;
	float p2[4];
	p2[0] = sin(ang) * cs->distance;
	p2[1] = 0.0;
	p2[2] = cos(ang) * cs->distance;
	p2[3] = - ((p2[0] * p2[0]) + (p2[0] * p2[0]));

	float tmp = (P.x * p2[0]) + (P.y * p2[1]) + (P.z * p2[2]) + p2[3];

	if (tmp > 0) return FALSE;
}

return TRUE;