geomc 1.0
A c++ linear algebra template library
|
An N-dimensional capsule shape. More...
#include <geomc/shape/Capsule.h>
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, N > | axis () const |
Rect< T, N > | bounds () const |
Vec< T, N > | clip (Vec< T, N > p) const |
Nearest point on the interior of the shape. | |
bool | contains (point_t p) const |
Shape-point intersection test. | |
bool | contains (Vec< T, N > p) const |
Shape-point overlap test. | |
point_t | convex_support (point_t d) const |
Rect< T, 1 > | intersect (const Ray< T, N > &r) const |
Ray/shape intersection. | |
bool | intersects (Sphere< T, N > s) const |
bool | intersects (const Convex< T, N, Shape > &other) const |
Convex shape overlap test. | |
T | measure_boundary () const |
Measure of the shape's boundary. | |
T | 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. | |
Vec< T, N > | normal (Vec< T, N > p) const |
Unit-length outward-facing direction. | |
bool | operator== (const Capsule &other) const |
point_t | project (point_t p) const |
Vec< T, N > | project (Vec< T, N > p) const |
Nearest point on the surface of the shape. | |
T | sdf (point_t p) const |
Signed distance function. | |
T | sdf (Vec< T, N > p) const |
Static Public Member Functions | |
static constexpr bool | admits_cusps () |
Public Attributes | |
point_t | p0 |
endpoints of the capsule axis. | |
point_t | p1 |
T | radius |
Static Public Attributes | |
static constexpr index_t | N |
The dimension of this object. | |
An N-dimensional capsule shape.
|
inherited |
The type of a point in this object's space.
An N-vector of T if N > 1, otherwise a T.
|
inlineconstexpr |
Construct a capsule centered on the origin, with radius 1, and axis from x = -1
to x = 1
.
Nearest point on the interior of the shape.
If p
is on the interior of the shape, return p
unaltered; otherwise orthogonally project p
to the shape's surface.
|
inlineinherited |
Shape-point overlap test.
Return true
if the point p
is on the surface or interior of the shape, false
otherwise.
Ray/shape intersection.
Return the possibly-empty range of ray parameters s
such that the Ray overlaps the shape at r.origin + s * r.direction
.
For non-convex objects with multiple regions of overlap, this method should return the interval containing the smallest positive value.
Sphere-capsule intersection test.
s | Another sphere. |
true
if s
overlaps with this sphere's volume, false otherwise. Convex shape overlap test.
other
; false otherwise. Unit-length outward-facing direction.
For any point, return the direction which points directly away from the nearest point on the shape, away from its interior.
This should be the same as the gradient of the sdf().
Return the point p
orthogonally projected onto the surface of the shape.
Nearest point on the surface of the shape.
Compute the point on the boundary of the shape which is closest to p
.
T radius |
Radius of the capsule; i.e. the distance from the axis which is inside the capsule.