2007-11-04 03:34:51 +00:00
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This file is part of GtkRadiant.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//returns true if the planes are equal
|
2012-03-17 20:01:54 +00:00
|
|
|
int Plane_Equal( plane_t *a, plane_t *b, int flip );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns false if the points are colinear
|
2012-03-17 20:01:54 +00:00
|
|
|
int Plane_FromPoints( vec3_t p1, vec3_t p2, vec3_t p3, plane_t *plane );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns true if the points are equal
|
2012-03-17 20:01:54 +00:00
|
|
|
int Point_Equal( vec3_t p1, vec3_t p2, float epsilon );
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
//allocate a winding
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t* Winding_Alloc( int points );
|
2007-11-04 03:34:51 +00:00
|
|
|
//free the winding
|
2012-03-17 20:01:54 +00:00
|
|
|
void Winding_Free( winding_t *w );
|
2007-11-04 03:34:51 +00:00
|
|
|
//create a base winding for the plane
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t* Winding_BaseForPlane( plane_t *p );
|
2007-11-04 03:34:51 +00:00
|
|
|
//make a winding clone
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t* Winding_Clone( winding_t *w );
|
2007-11-04 03:34:51 +00:00
|
|
|
//creates the reversed winding
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t* Winding_Reverse( winding_t *w );
|
2007-11-04 03:34:51 +00:00
|
|
|
//remove a point from the winding
|
2012-03-17 20:01:54 +00:00
|
|
|
void Winding_RemovePoint( winding_t *w, int point );
|
2007-11-04 03:34:51 +00:00
|
|
|
//inserts a point to a winding, creating a new winding
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t* Winding_InsertPoint( winding_t *w, vec3_t point, int spot );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns true if the planes are concave
|
2012-03-17 20:01:54 +00:00
|
|
|
int Winding_PlanesConcave( winding_t *w1, winding_t *w2,
|
|
|
|
vec3_t normal1, vec3_t normal2,
|
|
|
|
float dist1, float dist2 );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns true if the winding is tiny
|
2012-03-17 20:01:54 +00:00
|
|
|
int Winding_IsTiny( winding_t *w );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns true if the winding is huge
|
2012-03-17 20:01:54 +00:00
|
|
|
int Winding_IsHuge( winding_t *w );
|
2007-11-04 03:34:51 +00:00
|
|
|
//clip the winding with the plane
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t* Winding_Clip( winding_t *in, plane_t *split, qboolean keepon );
|
2007-11-04 03:34:51 +00:00
|
|
|
//split the winding with the plane
|
2012-03-17 20:01:54 +00:00
|
|
|
void Winding_SplitEpsilon( winding_t *in, vec3_t normal, double dist,
|
|
|
|
vec_t epsilon, winding_t **front, winding_t **back );
|
2007-11-04 03:34:51 +00:00
|
|
|
//try to merge the windings, returns the new merged winding or NULL
|
2012-03-17 20:01:54 +00:00
|
|
|
winding_t *Winding_TryMerge( winding_t *f1, winding_t *f2, vec3_t planenormal, int keep );
|
2007-11-04 03:34:51 +00:00
|
|
|
//create a plane for the winding
|
2012-03-17 20:01:54 +00:00
|
|
|
void Winding_Plane( winding_t *w, vec3_t normal, double *dist );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns the winding area
|
2012-03-17 20:01:54 +00:00
|
|
|
float Winding_Area( winding_t *w );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns the bounds of the winding
|
2012-03-17 20:01:54 +00:00
|
|
|
void Winding_Bounds( winding_t *w, vec3_t mins, vec3_t maxs );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns true if the point is inside the winding
|
2012-03-17 20:01:54 +00:00
|
|
|
int Winding_PointInside( winding_t *w, plane_t *plane, vec3_t point, float epsilon );
|
2007-11-04 03:34:51 +00:00
|
|
|
//returns true if the vector intersects with the winding
|
2012-03-17 20:01:54 +00:00
|
|
|
int Winding_VectorIntersect( winding_t *w, plane_t *plane, vec3_t p1, vec3_t p2, float epsilon );
|