Documentation for winding.

This commit is contained in:
Bill Currie 2010-08-31 10:46:38 +09:00
parent a8bd522ca1
commit 44776f111f
2 changed files with 72 additions and 19 deletions

View file

@ -32,12 +32,84 @@ typedef struct winding_s {
vec3_t points[8]; // variable sized
} winding_t;
/** Create a very large four-point winding with all point on the plane.
The winding will be a box with aligned with the axes of the plane.
\param p The plane for which to create the winding.
\return The new winding.
\note It is the caller's responsibiltiy to free the new winding.
*/
winding_t *BaseWindingForPlane (struct plane_s *p);
/** Create a new, empty winding with.
\param points The number of points for which to leave space.
\return The new winding.
\note It is the caller's responsibiltiy to free the new winding.
*/
winding_t *NewWinding (int points);
/** Free the winding.
\param w The winding to be freed.
*/
void FreeWinding (winding_t *w);
/** Create a new winding with the same points as the given winding.
\param w The winding to copy.
\return The new winding.
\note It is the caller's responsibiltiy to free the new winding.
*/
winding_t *CopyWinding (winding_t *w);
/** Create a new winding with the reverse points of the given winding.
\param w The winding to copy.
\return The new winding.
\note It is the caller's responsibiltiy to free the new winding.
*/
winding_t *CopyWindingReverse (winding_t *w);
/** Clip the winding to the plain.
The new winding will be the part of the input winding that is on the
front side of the plane.
\note It is the caller's responsibiltiy to free the new winding.
\note The input winding will be freed.
\param in The winding to be clipped.
\param split The plane by which the winding will be clipped.
\param keepon If true, an exactly on-plane winding will be saved,
otherwise it will be clipped away.
\return The new winding representing the part of the input winding
on the font side of the plane, or NULL if the winding has
been clipped away.
*/
winding_t *ClipWinding (winding_t *in, struct plane_s *split, qboolean keepon);
/** Divide a winding by a plane, producing one or two windings.
\note The original winding is not damaged or freed.
\note If one of \a front or \a back is NULL, the other will point to
the input winding.
\note If neither \a front nor \a back are NULL, then both will be new
windings and the caller will be responsible for freeing them.
\param in The winding to be divided.
\param split The plane by which the winding will be divided.
\param front Set to the part of the input winding that is in front of
the plane, or NULL if no part of the winding is in front
of the plane.
\param back Set to the part of the input winding that is behind the
plane, or NULL if no part of the winding is behind the
plane.
*/
void DivideWinding (winding_t *in, struct plane_s *split,
winding_t **front, winding_t **back);

View file

@ -135,17 +135,6 @@ CopyWindingReverse (winding_t *w)
return c;
}
/*
ClipWinding
Clips the winding to the plane, returning the new winding on the positive
side.
Frees the input winding.
If keepon is true, an exactly on-plane winding will be saved, otherwise
it will be clipped away.
*/
winding_t *
ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
{
@ -244,14 +233,6 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
return neww;
}
/*
DivideWinding
Divides a winding by a plane, producing one or two windings. The
original winding is not damaged or freed. If on only one side, the
returned winding will be the input winding. If on both sides, two
new windings will be created.
*/
void
DivideWinding (winding_t *in, plane_t *split, winding_t **front,
winding_t **back)