geomc 1.0
A c++ linear algebra template library
|
An axis-aligned extrusion of an arbitrary N-1 dimensional Convex shape. More...
#include <geomc/shape/Extrusion.h>
Public Types | |
typedef Shape::elem_t | T |
The coordinate type of this Shape. | |
typedef PointType< Shape::elem_t, N >::point_t | point_t |
typedef T | elem_t |
The coordinate type of this shape. | |
Public Member Functions | |
Extrusion () | |
Construct a new extrusion with unit height. | |
Extrusion (const Shape &base) | |
Construct a new extrusion with cross section base and unit height. | |
Extrusion (const Shape &base, const Rect< T, 1 > &height) | |
Construct an extrusion with cross section base and height range height . | |
Extrusion (const Shape &base, T h0, T h1) | |
Construct an extrusion with cross section base , and height ranging between h0 and h1 . | |
bool | contains (Vec< T, N > p) const |
T | sdf (Vec< T, N > p) const |
Vec< T, N > | project (Vec< T, N > p) const |
Vec< T, N > | convex_support (Vec< T, N > d) const |
Rect< T, N > | bounds () const |
Rect< T, 1 > | intersect (const Ray< T, N > &r) const |
Ray/shape intersection. | |
point_t | convex_support (point_t d) const |
Geometric convex support function. More... | |
bool | intersects (const Convex< Shape::elem_t, N, Shape > &other) const |
Convex shape overlap test. More... | |
T | sdf (Vec< T, N > p) const |
Signed distance function. More... | |
Vec< Shape::elem_t, N > | normal (Vec< Shape::elem_t, N > p) const |
Unit-length outward-facing direction. More... | |
Vec< Shape::elem_t, N > | clip (Vec< Shape::elem_t, N > p) const |
Nearest point on the interior of the shape. More... | |
bool | contains (Vec< T, N > p) const |
Shape-point overlap test. More... | |
Public Attributes | |
Shape | base |
Cross-section of this extrusion at the h = 0 plane. | |
Rect< T, 1 > | height |
Height range of this extrusion. | |
Static Public Attributes | |
static constexpr size_t | N = Shape::N + 1 |
The dimension of this Shape. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Shape > | |
Extrusion< Shape > | extrude (const Shape &s, typename Shape::elem_t h0, typename Shape::elem_t h1) |
Convenience function to extrude the shape s between heights h0 and h1 by wrapping s in the Extrusion template. | |
An axis-aligned extrusion of an arbitrary N-1 dimensional Convex shape.
The first N-1 dimensions have cross-sections which are Shape
s (e.g., Rect
, Sphere
, Frustum
...). The shape is lofted "vertically" into the last dimension.
Example:
// initialize a cylinder of length and radius 1: auto cylinder = Extrusion<Sphere<double,2>>(Sphere<double,2>(), Rect<double,1>(0,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.
Geometric convex support function.
Returns the point on the surface of this convex shape that is furthest along direction d
(i.e., has the highest dot product with d
).
All shapes which implement this function automatically support geometrical intersection tests with any other Convex object.
d | Direction along which to find a support plane. |
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.
Signed distance function.
Compute a signed distance to the nearest surface point on the shape. Points on the exterior have positive value; points on the interior have negative value; surface points have sdf value 0.