position.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* EQEMu: Everquest Server Emulator
  2. Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY except by those people which sell it, which
  8. are required to give you total support for your newly bought product;
  9. without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  10. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef POSITION_H
  16. #define POSITION_H
  17. #include <string>
  18. #include "../../depends/glm/vec2.hpp"
  19. #include "../../depends/glm/vec3.hpp"
  20. #include "../../depends/glm/vec4.hpp"
  21. #include "../../depends/glm/geometric.hpp"
  22. std::string to_string(const glm::vec4 &position);
  23. std::string to_string(const glm::vec3 &position);
  24. std::string to_string(const glm::vec2 &position);
  25. bool IsWithinAxisAlignedBox(const glm::vec3 &position, const glm::vec3 &minimum, const glm::vec3 &maximum);
  26. bool IsWithinAxisAlignedBox(const glm::vec2 &position, const glm::vec2 &minimum, const glm::vec2 &maximum);
  27. bool IsOrigin(const glm::vec2 &position);
  28. bool IsOrigin(const glm::vec3 &position);
  29. bool IsOrigin(const glm::vec4 &position);
  30. float DistanceSquared(const glm::vec2& point1, const glm::vec2& point2);
  31. float Distance(const glm::vec2& point1, const glm::vec2& point2);
  32. float DistanceSquared(const glm::vec3& point1, const glm::vec3& point2);
  33. float Distance(const glm::vec3& point1, const glm::vec3& point2);
  34. float DistanceNoZ(const glm::vec3& point1, const glm::vec3& point2);
  35. float DistanceSquaredNoZ(const glm::vec3& point1, const glm::vec3& point2);
  36. float DistanceSquared(const glm::vec4& point1, const glm::vec4& point2);
  37. float Distance(const glm::vec4& point1, const glm::vec4& point2);
  38. float DistanceNoZ(const glm::vec4& point1, const glm::vec4& point2);
  39. float DistanceSquaredNoZ(const glm::vec4& point1, const glm::vec4& point2);
  40. float GetReciprocalHeading(const glm::vec4& point1);
  41. float GetReciprocalHeading(const float heading);
  42. bool IsHeadingEqual(const float h1, const float h2);
  43. bool IsPositionEqual(const glm::vec2 &p1, const glm::vec2 &p2);
  44. bool IsPositionEqual(const glm::vec3 &p1, const glm::vec3 &p2);
  45. bool IsPositionEqual(const glm::vec4 &p1, const glm::vec4 &p2);
  46. bool IsPositionEqualWithinCertainZ(const glm::vec3 &p1, const glm::vec3 &p2, float z_eps);
  47. bool IsPositionEqualWithinCertainZ(const glm::vec4 &p1, const glm::vec4 &p2, float z_eps);
  48. bool IsPositionWithinSimpleCylinder(const glm::vec3 &p1, const glm::vec3 &cylinder_center, float cylinder_radius, float cylinder_height);
  49. bool IsPositionWithinSimpleCylinder(const glm::vec4 &p1, const glm::vec4 &cylinder_center, float cylinder_radius, float cylinder_height);
  50. float CalculateHeadingAngleBetweenPositions(float x1, float y1, float x2, float y2);
  51. #endif