geomc 1.0
A c++ linear algebra template library
Loading...
Searching...
No Matches
Extruded< Shape > Class Template Reference

An axis-aligned extrusion of an arbitrary N-1 dimensional Convex shape. More...

#include <geomc/shape/Extruded.h>

Inheritance diagram for Extruded< Shape >:
Convex< Shape::elem_t, Shape::N+1, Extruded< Shape > > RayIntersectable< Shape::elem_t, Shape::N+1, Extruded< Shape > > Projectable< Shape::elem_t, Shape::N+1, Extruded< Shape > > Bounded< Shape::elem_t, N, Extruded< Shape > > SdfEvaluable< Shape::elem_t, N, Extruded< Shape > > Dimensional< Shape::elem_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.
 
typedef Shape::elem_t T
 The coordinate type of this Shape.
 

Public Member Functions

 Extruded ()
 Construct a new extrusion with unit height.
 
 Extruded (const Shape &base)
 Construct a new extrusion with cross section base and unit height.
 
 Extruded (const Shape &base, const Rect< T, 1 > &height)
 Construct an extrusion with cross section base and height range height.
 
 Extruded (const Shape &base, T h0, T h1)
 Construct an extrusion with cross section base, and height ranging between h0 and h1.
 
Rect< T, Nbounds () const
 
Vec< Shape::elem_t, Nclip (Vec< Shape::elem_t, N > p) const
 Nearest point on the interior of the shape.
 
bool contains (Vec< T, N > p) const
 
point_t convex_support (point_t d) const
 Geometric convex support function.
 
Vec< T, Nconvex_support (Vec< T, N > d) const
 
Rect< T, 1 > intersect (const Ray< T, N > &r) const
 Ray/shape intersection.
 
bool intersects (const Convex< Shape::elem_t, N, Shape > &other) const
 Convex shape overlap test.
 
T measure_boundary () const
 Measure the boundary (surface area) of the extrusion.
 
T measure_interior () const
 Measure the interior (volume) of the extrusion.
 
Vec< T, Nnormal (Vec< T, N > p) const
 
bool operator== (const Extruded< Shape > &other) const
 
Vec< T, Nproject (Vec< T, N > p) const
 
T sdf (Vec< T, N > p) const
 

Static Public Member Functions

static constexpr bool admits_cusps ()
 

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 Symbols

(Note that these are not member symbols.)

template<typename Shape>
Extruded< 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 Extruded template.
 

Detailed Description

template<typename Shape>
class geom::Extruded< Shape >

An axis-aligned extrusion of an arbitrary N-1 dimensional Convex shape.

The first N-1 dimensions have cross-sections which are Shapes (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 = Extruded<Sphere<double,2>>(Sphere<double,2>(), Rect<double,1>(0,1));
// or equivalently, and more succinctly:
auto cylinder2 = extrude(Circle<double>(), 0, 1);

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.

Member Function Documentation

◆ clip()

Vec< Shape::elem_t, N > clip ( Vec< Shape::elem_t, N > p) const
inlineinherited

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_support()

point_t convex_support ( point_t d) const
inlineinherited

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.

Parameters
dDirection along which to find a support plane.
Returns
A point on the surface of this convex shape.

◆ intersects()

bool intersects ( const Convex< Shape::elem_t, N, Shape > & other) const
inlineinherited

Convex shape overlap test.

Returns
True if and only if this convex shape overlaps other; false otherwise.

◆ project()

template<typename Shape>
Vec< T, N > project ( Vec< T, N > p) const
inline

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


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