UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
polylib.h File Reference

Go to the source code of this file.

Data Structures

struct  winding_s
 for storing the vertices of the side of a brush or other polygon More...
 

Macros

#define MAX_POINTS_ON_WINDING   64
 

Typedefs

typedef struct winding_s winding_t
 for storing the vertices of the side of a brush or other polygon More...
 

Functions

winding_tAllocWinding (int points)
 Allocate a new winding (polygon) More...
 
vec_t WindingArea (const winding_t *w)
 
void WindingCenter (const winding_t *w, vec3_t center)
 
void ClipWindingEpsilon (const winding_t *in, const vec3_t normal, const vec_t dist, const vec_t epsilon, winding_t **front, winding_t **back)
 
winding_tChopWinding (winding_t *in, vec3_t normal, vec_t dist)
 
winding_tCopyWinding (const winding_t *w)
 Copy a winding with all its points allocated. More...
 
winding_tReverseWinding (const winding_t *w)
 
winding_tBaseWindingForPlane (const vec3_t normal, const vec_t dist)
 
void RemoveColinearPoints (winding_t *w)
 
void FreeWinding (winding_t *w)
 
void WindingBounds (const winding_t *w, vec3_t mins, vec3_t maxs)
 
void ChopWindingInPlace (winding_t **w, 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. More...
 
bool WindingIsHuge (const winding_t *w)
 Returns true if the winding still has one of the points from basewinding for plane. More...
 
bool FixWinding (winding_t *w)
 removes degenerate edges from a winding More...
 

Macro Definition Documentation

#define MAX_POINTS_ON_WINDING   64

Definition at line 36 of file polylib.h.

Referenced by ChopWindingInPlace(), ClipWindingEpsilon(), and RemoveColinearPoints().

Typedef Documentation

typedef struct winding_s winding_t

for storing the vertices of the side of a brush or other polygon

Function Documentation

winding_t* AllocWinding ( int  points)

Allocate a new winding (polygon)

Parameters
[in]pointsAmount of points for this winding
See also
FreeWinding

Definition at line 38 of file polylib.cpp.

References Mem_Alloc.

Referenced by BaseWindingForPlane(), Check_SidesOverlap(), ChopWindingInPlace(), ClipWindingEpsilon(), CopyWinding(), ReverseWinding(), TryMergeWinding(), and WindingFromFace().

winding_t* ChopWinding ( winding_t in,
vec3_t  normal,
vec_t  dist 
)
Returns
the fragment of in that is on the front side of the cliping plane.
Note
The original is freed.

Definition at line 391 of file polylib.cpp.

References ClipWindingEpsilon(), f, FreeWinding(), and ON_EPSILON.

void ClipWindingEpsilon ( const winding_t in,
const vec3_t  normal,
const vec_t  dist,
const vec_t  epsilon,
winding_t **  front,
winding_t **  back 
)
winding_t* CopyWinding ( const winding_t w)

Copy a winding with all its points allocated.

Parameters
[in]wThe winding to copy
Returns
the new winding

Definition at line 185 of file polylib.cpp.

References AllocWinding(), and winding_s::numpoints.

Referenced by ClipWindingEpsilon(), CopyBrush(), FaceFromPortal(), MakeBspBrushList(), and SplitBrush().

bool FixWinding ( winding_t w)

removes degenerate edges from a winding

Returns
true if the winding is valid

Definition at line 478 of file polylib.cpp.

References i, winding_s::numpoints, ON_EPSILON, winding_s::p, SnapWeldVector(), VectorCopy, VectorLength(), and VectorSubtract.

Referenced by CreateBrushWindings().

void FreeWinding ( winding_t w)
void RemoveColinearPoints ( winding_t w)
winding_t* ReverseWinding ( const winding_t w)

Definition at line 193 of file polylib.cpp.

References AllocWinding(), i, winding_s::numpoints, winding_s::p, and VectorCopy.

Referenced by FaceFromPortal().

void WindingBounds ( const winding_t w,
vec3_t  mins,
vec3_t  maxs 
)

Definition at line 97 of file polylib.cpp.

References AddPointToBounds(), ClearBounds(), i, winding_s::numpoints, and winding_s::p.

Referenced by SubdividePatch().

void WindingCenter ( const winding_t w,
vec3_t  center 
)
bool WindingIsHuge ( const winding_t w)

Returns true if the winding still has one of the points from basewinding for plane.

Definition at line 427 of file polylib.cpp.

References i, MAX_WORLD_WIDTH, winding_s::numpoints, and winding_s::p.

Referenced by SplitBrush().

bool WindingIsTiny ( winding_t w)

Returns true if the winding would be crunched out of existance by the vertex snapping.

Definition at line 407 of file polylib.cpp.

References EDGE_LENGTH, i, len, winding_s::numpoints, winding_s::p, VectorLength(), and VectorSubtract.

Referenced by MakeNodePortal(), SplitBrush(), and SplitNodePortals().