Make some improvements to the winding docs.

This commit is contained in:
Bill Currie 2011-11-12 12:17:45 +09:00
parent 6b62b850a7
commit 2457837b37
2 changed files with 17 additions and 5 deletions

View File

@ -33,21 +33,27 @@
struct plane_s;
typedef struct winding_s {
int numpoints;
vec3_t points[8]; // variable sized
int numpoints; ///< The number of points in the winding
vec3_t points[3]; ///< variable sized, never less than 3
} 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.
The winding will be a box with aligned with the axes of the plane. The
order of yhe points is clockwise when viewed from the front side of
the plane.
\param p The plane for which to create the winding.
In terms of s and t, the axes of the plane will be such that t (up) is
the projection of either the z-axis or the x-axis (whichever is
"closer"), and s is to the right (n = s cross t).
\param p The plane on which to create the winding.
\return The new winding.
\note It is the caller's responsibiltiy to free the new winding.
*/
winding_t *BaseWindingForPlane (const struct plane_s *p);
/** Create a new, empty winding with.
/** Create a new, empty winding with space for the specified number of points.
\param points The number of points for which to leave space.
\return The new winding.
@ -71,6 +77,8 @@ winding_t *CopyWinding (const winding_t *w);
/** Create a new winding with the reverse points of the given winding.
This is useful when a winding for the back side of a plane is required.
\param w The winding to copy.
\return The new winding.
\note It is the caller's responsibiltiy to free the new winding.
@ -82,6 +90,8 @@ winding_t *CopyWindingReverse (const winding_t *w);
The new winding will be the part of the input winding that is on the
front side of the plane.
The direction of the winding is preserved.
\note It is the caller's responsibiltiy to free the new winding.
\note The input winding will be freed.

View File

@ -153,6 +153,7 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
counts[0] = counts[1] = counts[2] = 0;
// +1 for duplicating the first point
sides = alloca ((in->numpoints + 1) * sizeof (int));
dists = alloca ((in->numpoints + 1) * sizeof (vec_t));
@ -170,6 +171,7 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
}
counts[sides[i]]++;
}
// duplicate the first point
sides[i] = sides[0];
dists[i] = dists[0];