mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 00:30:57 +00:00
Add a function to obtain the unit vectors of a winding's edges.
This commit is contained in:
parent
e41da2f579
commit
662c04dfdc
2 changed files with 27 additions and 0 deletions
|
@ -86,6 +86,15 @@ winding_t *CopyWinding (const winding_t *w);
|
||||||
*/
|
*/
|
||||||
winding_t *CopyWindingReverse (const winding_t *w);
|
winding_t *CopyWindingReverse (const winding_t *w);
|
||||||
|
|
||||||
|
/** Create a new "winding" that holds the unit vectors of the edges of the
|
||||||
|
given winding.
|
||||||
|
|
||||||
|
\param w The winding to convert.
|
||||||
|
\return The "winding" holding the unit vectors.
|
||||||
|
\note It is the caller's responsibiltiy to free the new winding.
|
||||||
|
*/
|
||||||
|
winding_t *WindingVectors (const winding_t *w);
|
||||||
|
|
||||||
/** Clip the winding to the plain.
|
/** Clip the winding to the plain.
|
||||||
|
|
||||||
The new winding will be the part of the input winding that is on the
|
The new winding will be the part of the input winding that is on the
|
||||||
|
|
|
@ -140,6 +140,24 @@ CopyWindingReverse (const winding_t *w)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
winding_t *
|
||||||
|
WindingVectors (const winding_t *w)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
size_t size;
|
||||||
|
winding_t *c;
|
||||||
|
|
||||||
|
size = (size_t) (uintptr_t) &((winding_t *) 0)->points[w->numpoints];
|
||||||
|
c = malloc (size);
|
||||||
|
c->numpoints = w->numpoints;
|
||||||
|
for (i = 0; i < w->numpoints; i++) {
|
||||||
|
VectorSubtract (w->points[(i + 1) % w->numpoints], w->points[i],
|
||||||
|
c->points[i]);
|
||||||
|
VectorNormalize (c->points[i]);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
winding_t *
|
winding_t *
|
||||||
ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
|
ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue