geomc 1.0
A c++ linear algebra template library
Public Member Functions | List of all members
Projectable< T, N, Derived > Class Template Reference

Base class describing N-dimensional shapes which implement the ability to project an arbitrary point to the nearest point on their surface. More...

#include <geomc/shape/Shape.h>

Inheritance diagram for Projectable< T, N, Derived >:
SdfEvaluable< T, N, Derived >

Public Member Functions

Vec< T, N > project (Vec< T, N > p) const
 Nearest point on the surface of the shape. More...
 
sdf (Vec< T, N > p) const
 
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...
 
bool contains (Vec< T, N > p) const
 Shape-point overlap test. More...
 

Detailed Description

template<typename T, index_t N, typename Derived>
class geom::Projectable< T, N, Derived >

Base class describing N-dimensional shapes which implement the ability to project an arbitrary point to the nearest point on their surface.

Uses the curiously-recurring template pattern to perform static polymorphism. Override project() and at least one of sdf() or contains() in the derived implementation.

Member Function Documentation

◆ clip()

Vec< T, N > clip ( Vec< T, N >  p) const
inline

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.

◆ contains()

bool contains ( Vec< T, N >  p) const
inlineinherited

Shape-point overlap test.

Return true if the point p is on the surface or interior of the shape, false otherwise.

◆ normal()

Vec< T, N > normal ( Vec< T, N >  p) const
inline

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

◆ project()

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

Nearest point on the surface of the shape.

Compute the point on the boundary of the shape which is closest to p.


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