geomc 1.0
A c++ linear algebra template library
Loading...
Searching...
No Matches
Capsule< T, N > Class Template Reference

An N-dimensional capsule shape. More...

#include <geomc/shape/Capsule.h>

Inheritance diagram for Capsule< T, N >:
Dimensional< T, N >

Public Types

using elem_t
 The coordinate type of this object.
using point_t
 The type of a point in this object's space.

Public Member Functions

constexpr Capsule ()
constexpr Capsule (point_t p0, point_t p1, T r)
Vec< T, Naxis () const
Rect< T, Nbounds () const
point_t clip (point_t p) const
bool contains (point_t p) const
 Shape-point intersection test.
point_t convex_support (point_t d) const
template<ConvexObject Shape>
bool intersects (const Shape &other) const
bool intersects (Sphere< T, N > s) const
measure_boundary () const
 Measure of the shape's boundary.
measure_interior () const
 Measure of the shape's interior.
point_t nearest_axis_point (point_t p) const
point_t normal (point_t p) const
 Outward-facing direction.
bool operator== (const Capsule &other) const
point_t project (point_t p) const
sdf (point_t p) const
 Signed distance function.

Static Public Member Functions

static constexpr bool admits_cusps ()

Public Attributes

point_t p0
 endpoints of the capsule axis.
point_t p1
radius

Static Public Attributes

static constexpr index_t N
 The dimension of this object.

Detailed Description

template<typename T, index_t N>
class geom::Capsule< T, N >

An N-dimensional capsule shape.

Member Typedef Documentation

◆ point_t

using point_t
inherited

The type of a point in this object's space.

An N-vector of T if N > 1, otherwise a T.

Constructor & Destructor Documentation

◆ Capsule()

template<typename T, index_t N>
Capsule ( )
inlineconstexpr

Construct a capsule centered on the origin, with radius 1, and axis from x = -1 to x = 1.

Member Function Documentation

◆ intersects()

template<typename T, index_t N>
bool intersects ( Sphere< T, N > s) const
inline

Sphere-capsule intersection test.

Parameters
sAnother sphere.
Returns
true if s overlaps with this sphere's volume, false otherwise.

◆ project()

template<typename T, index_t N>
point_t project ( point_t p) const
inline

Return the point p orthogonally projected onto the surface of the shape.

Member Data Documentation

◆ radius

template<typename T, index_t N>
T radius

Radius of the capsule; i.e. the distance from the axis which is inside the capsule.


The documentation for this class was generated from the following file: