enmath2d.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * \defgroup Math2D Math2D library
  3. * @{
  4. */
  5. //-----------------------------------------------------------------------------
  6. //! exposed from C++ (do not change)
  7. enum WindingOrder
  8. {
  9. CounterClockwise, // 0
  10. Clockwise, // 1
  11. Invalid // 2
  12. }
  13. class Math2D
  14. {
  15. private void Math2D();
  16. private void ~Math2D();
  17. /*!
  18. Check if a `point` is inside `polygon`.
  19. Takes polygon and point only in the XZ plane.
  20. */
  21. static proto bool IsPointInPolygonXZ(notnull array<vector> polygon, vector point);
  22. //! Check if `point` is inside triangle specified by points `p1`, `p2` and `p3`.
  23. static proto bool IsPointInTriangleXZ(vector p1, vector p2, vector p3, vector point);
  24. /*!
  25. Check if a point is inside `polygon`.
  26. \param polygon Must be an array of Vector2, every two consecutive floats represent one point in polygon.
  27. \param x X coordinate of point to test
  28. \param y Y coordinate of point to test
  29. */
  30. static proto bool IsPointInPolygon(notnull array<float> polygon, float x, float y);
  31. /*!
  32. Determines winding order of triangle given by points `a`, `b`, `c`. If the triangles
  33. form a line, WindingOrder.Invalid is returned.
  34. */
  35. static proto WindingOrder TriangleWindingXZ(vector a, vector b, vector c);
  36. }
  37. //@}