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

An N-dimensional cylinder, given by its radius and endpoints. More...

#include <geomc/shape/Cylinder.h>

Inheritance diagram for Cylinder< T, N >:
Convex< T, N, Cylinder< T, N > > RayIntersectable< T, N, Cylinder< T, N > > Projectable< T, N, Cylinder< T, N > > Bounded< T, N, Cylinder< T, N > > SdfEvaluable< T, N, Cylinder< 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

 Cylinder ()
 Construct a cylinder of radius 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.
 
 Cylinder (T r)
 Construct a cylinder of radius r and length 1, with axis along X+.
 
Rect< T, Nbounds () const
 
Vec< T, Nclip (Vec< T, N > p) const
 Nearest point on the interior of the shape.
 
bool contains (Vec< T, N > p) const
 Shape-point intersection test.
 
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 > &ray) const
 Ray/shape intersection test.
 
bool intersects (const Convex< T, N, Shape > &other) const
 Convex shape overlap test.
 
measure_boundary () const
 Measure the boundary (surface area) of the cylinder.
 
measure_interior () const
 Measure the interior (volume) of the cylinder.
 
Vec< T, Nnormal (Vec< T, N > p) const
 
bool operator== (const Cylinder< T, N > &other) const
 
Vec< T, Nproject (Vec< T, N > p) const
 
sdf (Vec< T, N > p) const
 Signed distance function.
 

Static Public Member Functions

static constexpr bool admits_cusps ()
 

Public Attributes

Vec< T, Np0
 Axis endpoint.
 
Vec< T, Np1
 Axis endpoint.
 
radius
 Cylinder radius.
 

Static Public Attributes

static constexpr index_t N
 The dimension of this object.
 

Detailed Description

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

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.

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

◆ Cylinder()

template<typename T, index_t N>
Cylinder ( const Vec< T, N > & p0,
const Vec< T, N > & p1,
T radius )
inline

Construct a cylinder with arbitrary radius and endpoints.

Parameters
p0An endpoint of the cylinder axis.
p1An endpoint of the cylinder axis.
radiusRadius of cylinder.

Member Function Documentation

◆ bounds()

template<typename T, index_t N>
Rect< T, N > bounds ( ) const
inline
Returns
An axis-aligned bounding box completely containing this cylinder.

◆ clip()

Vec< T, N > clip ( Vec< 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< T, N, Shape > & other) const
inlineinherited

Convex shape overlap test.

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

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