geomc 1.0
A c++ linear algebra template library
|
An N-dimensional cylinder, given by its radius and endpoints. More...
#include <geomc/shape/Cylinder.h>
Public Types | |
typedef PointType< T, N >::point_t | point_t |
typedef T | elem_t |
The coordinate type of this shape. | |
Public Member Functions | |
Cylinder () | |
Construct a cylinder of radius and length 1, with axis along X+. | |
Cylinder (T r) | |
Construct a cylinder of radius r and length 1, with axis along X+. | |
Cylinder (const Vec< T, N > &p0, const Vec< T, N > &p1, T radius) | |
Construct a cylinder with arbitrary radius and endpoints. More... | |
bool | contains (Vec< T, N > p) const |
Shape-point intersection test. | |
T | sdf (Vec< T, N > p) const |
Signed distance function. | |
Vec< T, N > | project (Vec< T, N > p) const |
Rect< T, N > | bounds () const |
Vec< T, N > | convex_support (Vec< T, N > d) const |
Rect< T, 1 > | intersect (const Ray< T, N > &ray) const |
Ray/shape intersection test. | |
bool | intersects (const Convex< T, N, Shape > &other) const |
Convex shape overlap test. More... | |
Vec< T, N > | normal (Vec< T, N > p) const |
Unit-length outward-facing direction. More... | |
Vec< T, N > | clip (Vec< T, N > p) const |
Nearest point on the interior of the shape. More... | |
Public Attributes | |
Vec< T, N > | p0 |
Axis endpoint. | |
Vec< T, N > | p1 |
Axis endpoint. | |
T | radius |
Cylinder radius. | |
Static Public Attributes | |
static constexpr size_t | N = _N |
The dimension of this shape. | |
An N-dimensional cylinder, given by its radius and endpoints.
Represents an extrusion of an N-2 sphere. In other words, an extrusion of a disk in 3D; an extrusion of a sphere in 4D; and an extrusion of a line segment in 2D.
If p0 == p1
, the behavior is undefined.
Construct a cylinder with arbitrary radius and endpoints.
p0 | An endpoint of the cylinder axis. |
p1 | An endpoint of the cylinder axis. |
radius | Radius of cylinder. |
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.
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().