BsCapsule.h 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "BsPrerequisitesUtil.h"
  3. #include "BsVector3.h"
  4. #include "BsLineSegment3.h"
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup Math
  8. * @{
  9. */
  10. /** Represents a capsule represented by a line segment and a radius. */
  11. class BS_UTILITY_EXPORT Capsule
  12. {
  13. public:
  14. Capsule();
  15. Capsule(const LineSegment3& segment, float radius);
  16. /**
  17. * Ray/capsule intersection.
  18. *
  19. * @return Boolean result and distance to the nearest intersection point.
  20. */
  21. std::pair<bool, float> intersects(const Ray& ray) const;
  22. /**
  23. * Returns the line segment along which the capsule lies.
  24. * All capsule points are at equal distance from this segment.
  25. */
  26. const LineSegment3& getSegment() const { return mSegment; }
  27. /** Returns the radius of the capsule. It defines the distance of the capsule from its line segment. */
  28. float getRadius() const { return mRadius; }
  29. private:
  30. LineSegment3 mSegment;
  31. float mRadius;
  32. };
  33. /** @} */
  34. }