intersection.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2012-2014 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "math_types.h"
  7. #include "sphere.h"
  8. namespace crown
  9. {
  10. /// Returns the distance along ray (from, dir) to intersection point with plane @a p
  11. /// or -1.0 if no intersection.
  12. float ray_plane_intersection(const Vector3& from, const Vector3& dir, const Plane& p);
  13. /// Returns the distance along ray (from, dir) to intersection point with sphere @a s
  14. /// or -1.0 if no intersection.
  15. float ray_sphere_intersection(const Vector3& from, const Vector3& dir, const Sphere& s);
  16. /// Returns the distance along ray (from, dir) to intersection point with @a obb
  17. /// or -1.0 if no intersection.
  18. float ray_oobb_intersection(const Vector3& from, const Vector3& dir, const OBB& obb);
  19. bool plane_3_intersection(const Plane& p1, const Plane& p2, const Plane& p3, Vector3& ip);
  20. bool frustum_sphere_intersection(const Frustum& f, const Sphere& s);
  21. bool frustum_box_intersection(const Frustum& f, const AABB& b);
  22. } // namespace crown