31#define BOGUS_RANGE 8192
48 if (*(
unsigned* )w == 0xdeaddead)
49 Sys_Error(
"FreeWinding: freed a freed winding");
50 *(
unsigned* )w = 0xdeaddead;
78 memcpy(w->
p, p, nump *
sizeof(p[0]));
125 for (
int i = 0;
i < 3;
i++) {
133 Sys_Error(
"BaseWindingForPlane: no axis found");
221 else if (dot < -epsilon)
270 if (sides[
i + 1] ==
SIDE_ON || sides[
i + 1] == sides[
i])
276 dot = dists[
i] / (dists[
i] - dists[
i + 1]);
278 for (
int j = 0; j < 3; j++) {
281 else if (normal[j] == -1)
284 mid[j] = p1[j] + dot * (p2[j] - p1[j]);
293 if (
f->numpoints > maxpts || b->
numpoints > maxpts)
294 Sys_Error(
"ClipWinding: points exceeded estimate");
296 Sys_Error(
"ClipWinding: MAX_POINTS_ON_WINDING");
316 else if (dot < -epsilon)
355 if (sides[
i + 1] ==
SIDE_ON || sides[
i + 1] == sides[
i])
361 dot = dists[
i] / (dists[
i] - dists[
i + 1]);
364 for (
int j = 0; j < 3; j++) {
367 else if (normal[j] == -1)
370 mid[j] = p1[j] + dot * (p2[j] - p1[j]);
377 if (
f->numpoints > maxpts)
378 Sys_Error(
"ClipWinding: points exceeded estimate");
380 Sys_Error(
"ClipWinding: MAX_POINTS_ON_WINDING");
402#define EDGE_LENGTH 0.2
411 const int j = ((
i == w->
numpoints - 1) ? 0 :
i) + 1;
430 for (
int j = 0; j < 3; j++)
437#define SNAP_EPSILON 0.01
446 if (a ==
nullptr || b ==
nullptr || out ==
nullptr)
450 for (
int i = 0;
i < 3;
i++) {
452 const double ai = rint(a[
i]);
453 const double bi = rint(a[
i]);
462 else if (fabs(ai - a[
i]) < fabs(bi - b[
i]))
468 vec_t outi = rint(out[
i]);
#define MAX_WORLD_WIDTH
-MAX_WORLD_WIDTH up tp +MAX_WORLD_WIDTH
void Sys_Error(const char *error,...)
void ClearBounds(vec3_t mins, vec3_t maxs)
Sets mins and maxs to their starting points before using AddPointToBounds.
vec_t VectorNormalize(vec3_t v)
Calculate unit vector for a given vec3_t.
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb).
void AddPointToBounds(const vec3_t v, vec3_t mins, vec3_t maxs)
If the point is outside the box defined by mins and maxs, expand the box to accommodate it....
void CrossProduct(const vec3_t v1, const vec3_t v2, vec3_t cross)
binary operation on vectors in a three-dimensional space
winding_t * ChopWinding(winding_t *in, vec3_t normal, vec_t dist)
void FreeWinding(winding_t *w)
void ChopWindingInPlace(winding_t **inout, const vec3_t normal, const vec_t dist, const vec_t epsilon)
bool WindingIsTiny(winding_t *w)
Returns true if the winding would be crunched out of existance by the vertex snapping.
winding_t * ReverseWinding(const winding_t *w)
static void SnapWeldVector(const vec3_t a, const vec3_t b, vec3_t out)
welds two vec3_t's into a third, taking into account nearest-to-integer instead of averaging
winding_t * AllocWinding(int points)
Allocate a new winding (polygon).
void RemoveColinearPoints(winding_t *w)
bool WindingIsHuge(const winding_t *w)
Returns true if the winding still has one of the points from basewinding for plane.
winding_t * BaseWindingForPlane(const vec3_t normal, const vec_t dist)
void WindingCenter(const winding_t *w, vec3_t center)
void WindingBounds(const winding_t *w, vec3_t mins, vec3_t maxs)
bool FixWinding(winding_t *w)
removes degenerate edges from a winding
vec_t WindingArea(const winding_t *w)
winding_t * CopyWinding(const winding_t *w)
Copy a winding with all its points allocated.
void ClipWindingEpsilon(const winding_t *in, const vec3_t normal, const vec_t dist, const vec_t epsilon, winding_t **front, winding_t **back)
#define MAX_POINTS_ON_WINDING
QGL_EXTERN GLuint GLchar GLuint * len
QGL_EXTERN int GLboolean GLfloat * v
for storing the vertices of the side of a brush or other polygon
static const vec3_t scale
#define VectorSubtract(a, b, dest)
#define VectorCopy(src, dest)
#define VectorAdd(a, b, dest)
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
#define VectorScale(in, scale, out)