UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
polylib.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 1997-2001 Id Software, Inc.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #include "../../../shared/mathlib.h"
28 
30 typedef struct winding_s {
31  int numpoints;
32  vec3_t p[4];
34 } winding_t;
35 
36 #define MAX_POINTS_ON_WINDING 64
37 
38 winding_t* AllocWinding(int points);
39 vec_t WindingArea(const winding_t* w);
40 void WindingCenter(const winding_t* w, vec3_t center);
41 void ClipWindingEpsilon(const winding_t* in, const vec3_t normal, const vec_t dist,
42  const vec_t epsilon, winding_t** front, winding_t** back);
43 winding_t* ChopWinding(winding_t* in, vec3_t normal, vec_t dist);
46 winding_t* BaseWindingForPlane(const vec3_t normal, const vec_t dist);
48 void FreeWinding(winding_t* w);
49 void WindingBounds(const winding_t* w, vec3_t mins, vec3_t maxs);
50 
51 /* frees the original if clipped */
52 void ChopWindingInPlace(winding_t** w, const vec3_t normal, const vec_t dist, const vec_t epsilon);
53 bool WindingIsTiny(winding_t* w);
54 bool WindingIsHuge(const winding_t* w);
55 bool FixWinding(winding_t* w);
winding_t * ChopWinding(winding_t *in, vec3_t normal, vec_t dist)
Definition: polylib.cpp:391
float vec_t
Definition: ufotypes.h:37
winding_t * BaseWindingForPlane(const vec3_t normal, const vec_t dist)
Definition: polylib.cpp:116
winding_t * CopyWinding(const winding_t *w)
Copy a winding with all its points allocated.
Definition: polylib.cpp:185
winding_t * ReverseWinding(const winding_t *w)
Definition: polylib.cpp:193
void FreeWinding(winding_t *w)
Definition: polylib.cpp:46
for storing the vertices of the side of a brush or other polygon
Definition: polylib.h:30
vec_t WindingArea(const winding_t *w)
Definition: polylib.cpp:81
bool WindingIsTiny(winding_t *w)
Returns true if the winding would be crunched out of existance by the vertex snapping.
Definition: polylib.cpp:407
void ClipWindingEpsilon(const winding_t *in, const vec3_t normal, const vec_t dist, const vec_t epsilon, winding_t **front, winding_t **back)
Definition: polylib.cpp:204
void WindingCenter(const winding_t *w, vec3_t center)
Definition: polylib.cpp:106
void RemoveColinearPoints(winding_t *w)
Definition: polylib.cpp:55
vec3_t p[4]
Definition: polylib.h:32
winding_t * AllocWinding(int points)
Allocate a new winding (polygon)
Definition: polylib.cpp:38
vec_t vec3_t[3]
Definition: ufotypes.h:39
void WindingBounds(const winding_t *w, vec3_t mins, vec3_t maxs)
Definition: polylib.cpp:97
bool WindingIsHuge(const winding_t *w)
Returns true if the winding still has one of the points from basewinding for plane.
Definition: polylib.cpp:427
bool FixWinding(winding_t *w)
removes degenerate edges from a winding
Definition: polylib.cpp:478
struct winding_s winding_t
for storing the vertices of the side of a brush or other polygon
void ChopWindingInPlace(winding_t **w, const vec3_t normal, const vec_t dist, const vec_t epsilon)
Definition: polylib.cpp:299
int numpoints
Definition: polylib.h:31