polylib.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1997-2006 Id Software, Inc.
  4. This file is part of Quake 2 Tools source code.
  5. Quake 2 Tools 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 2 Tools 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 Quake 2 Tools source code; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. typedef struct
  19. {
  20. int numpoints;
  21. vec3_t p[4]; // variable sized
  22. } winding_t;
  23. #define MAX_POINTS_ON_WINDING 64
  24. // you can define on_epsilon in the makefile as tighter
  25. #ifndef ON_EPSILON
  26. #define ON_EPSILON 0.1
  27. #endif
  28. winding_t *AllocWinding (int points);
  29. vec_t WindingArea (winding_t *w);
  30. void WindingCenter (winding_t *w, vec3_t center);
  31. void ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist,
  32. vec_t epsilon, winding_t **front, winding_t **back);
  33. winding_t *ChopWinding (winding_t *in, vec3_t normal, vec_t dist);
  34. winding_t *CopyWinding (winding_t *w);
  35. winding_t *ReverseWinding (winding_t *w);
  36. winding_t *BaseWindingForPlane (vec3_t normal, vec_t dist);
  37. void CheckWinding (winding_t *w);
  38. void WindingPlane (winding_t *w, vec3_t normal, vec_t *dist);
  39. void RemoveColinearPoints (winding_t *w);
  40. int WindingOnPlaneSide (winding_t *w, vec3_t normal, vec_t dist);
  41. void FreeWinding (winding_t *w);
  42. void WindingBounds (winding_t *w, vec3_t mins, vec3_t maxs);
  43. void ChopWindingInPlace (winding_t **w, vec3_t normal, vec_t dist, vec_t epsilon);
  44. // frees the original if clipped
  45. void pw(winding_t *w);