templt.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**********************************************************************
  2. *<
  3. FILE: templt.h
  4. DESCRIPTION: Defines 2D Template Object
  5. CREATED BY: Tom Hudson
  6. HISTORY: created 31 October 1995
  7. *> Copyright (c) 1995, All Rights Reserved.
  8. **********************************************************************/
  9. #ifndef __TEMPLT_H__
  10. #define __TEMPLT_H__
  11. class PolyLine;
  12. class Spline3D;
  13. // A handy 2D floating-point box class
  14. class Box2D {
  15. public:
  16. BOOL empty;
  17. Point2 min, max;
  18. Box2D() { empty = TRUE; }
  19. void SetEmpty() { empty = TRUE; }
  20. CoreExport Box2D& operator+=(const Point2& p); // expand this box to include p
  21. };
  22. // This object is used to test shapes for self-intersection, clockwise status, point
  23. // surrounding and intersection with other templates. The last and first points will be the
  24. // same if it is closed.
  25. class Template {
  26. public:
  27. int points;
  28. BOOL closed;
  29. Point2 *pts;
  30. Template(Spline3D *spline);
  31. Template(PolyLine *line);
  32. void Create(PolyLine *line);
  33. ~Template();
  34. Points() { return points; }
  35. BOOL SurroundsPoint(Point2& point);
  36. BOOL IsClockWise();
  37. BOOL SelfIntersects();
  38. BOOL Intersects(Template &t);
  39. Box2D Bound();
  40. };
  41. #endif // __TEMPLT_H__