Winding.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. //returns true if the planes are equal
  19. int Plane_Equal(plane_t *a, plane_t *b, int flip);
  20. //returns false if the points are colinear
  21. int Plane_FromPoints(vec3_t p1, vec3_t p2, vec3_t p3, plane_t *plane);
  22. //returns true if the points are equal
  23. int Point_Equal(vec3_t p1, vec3_t p2, float epsilon);
  24. //allocate a winding
  25. winding_t* Winding_Alloc(int points);
  26. //free the winding
  27. void Winding_Free(winding_t *w);
  28. //create a base winding for the plane
  29. winding_t* Winding_BaseForPlane (plane_t *p);
  30. //make a winding clone
  31. winding_t* Winding_Clone(winding_t *w );
  32. //creates the reversed winding
  33. winding_t* Winding_Reverse(winding_t *w);
  34. //remove a point from the winding
  35. void Winding_RemovePoint(winding_t *w, int point);
  36. //inserts a point to a winding, creating a new winding
  37. winding_t* Winding_InsertPoint(winding_t *w, vec3_t point, int spot);
  38. //returns true if the planes are concave
  39. int Winding_PlanesConcave(winding_t *w1, winding_t *w2,
  40. vec3_t normal1, vec3_t normal2,
  41. float dist1, float dist2);
  42. //returns true if the winding is tiny
  43. int Winding_IsTiny(winding_t *w);
  44. //returns true if the winding is huge
  45. int Winding_IsHuge(winding_t *w);
  46. //clip the winding with the plane
  47. winding_t* Winding_Clip(winding_t *in, plane_t *split, qboolean keepon);
  48. //split the winding with the plane
  49. void Winding_SplitEpsilon(winding_t *in, vec3_t normal, double dist,
  50. vec_t epsilon, winding_t **front, winding_t **back);
  51. //try to merge the windings, returns the new merged winding or NULL
  52. winding_t *Winding_TryMerge(winding_t *f1, winding_t *f2, vec3_t planenormal, int keep);
  53. //create a plane for the winding
  54. void Winding_Plane(winding_t *w, vec3_t normal, double *dist);
  55. //returns the winding area
  56. float Winding_Area(winding_t *w);
  57. //returns the bounds of the winding
  58. void Winding_Bounds(winding_t *w, vec3_t mins, vec3_t maxs);
  59. //returns true if the point is inside the winding
  60. int Winding_PointInside(winding_t *w, plane_t *plane, vec3_t point, float epsilon);
  61. //returns true if the vector intersects with the winding
  62. int Winding_VectorIntersect(winding_t *w, plane_t *plane, vec3_t p1, vec3_t p2, float epsilon);