struct TCapsule

template<typename T>

Represents a capsule with a line segment and a radius.

Public

Constructors

TCapsule<T>

TCapsule<T>() = default

TCapsule<T>

TCapsule<T>(const TLineSegment3<T> &segment, T radius)

Methods

Intersects

std::pair<bool, T> Intersects(const TRay<T> &ray) const

Ray/capsule intersection.

Returns: Boolean result and distance to the nearest intersection point.

GetSegment

const TLineSegment3<T> &GetSegment() const

Returns the line segment along which the capsule lies.

All capsule points are at equal distance from this segment.

GetRadius

T GetRadius() const

Returns the radius of the capsule.

It defines the distance of the capsule from its line segment.

GetHeight

T GetHeight() const

Returns the height of the capsule.

The height is the distance between centers of the hemispheres that form the capsule's ends.

GetCenter

TVector3<T> GetCenter() const

Returns the center point of the capsule.

Private

Fields

mSegment

TLineSegment3<T> mSegment

mRadius

T mRadius