Celeritas
0.5.0-86+4a8eea4
|
Return a simplified, regularized version of a surface/sense pair. More...
#include <SurfaceSimplifier.hh>
Public Member Functions | |
SurfaceSimplifier (Sense *s, real_type tol) | |
Construct with snapping tolerance and reference to sense. | |
SurfaceSimplifier (Sense *s) | |
Construct with reference to sense that may be flipped. | |
template<Axis T> | |
Optional< PlaneAligned< T > > | operator() (PlaneAligned< T > const &) const |
template<Axis T> | |
Optional< CylCentered< T > > | operator() (CylAligned< T > const &) const |
template<Axis T> | |
Optional< ConeAligned< T > > | operator() (ConeAligned< T > const &) const |
Optional< PlaneAligned< Axis::x >, PlaneAligned< Axis::y >, PlaneAligned< Axis::z >, Plane > | operator() (Plane const &) const |
Plane may be flipped, adjusted, or become axis-aligned. | |
Optional< SphereCentered > | operator() (Sphere const &) const |
Sphere near center can be snapped. | |
Optional< Plane, Sphere, CylAligned< Axis::x >, CylAligned< Axis::y >, CylAligned< Axis::z >, ConeAligned< Axis::x >, ConeAligned< Axis::y >, ConeAligned< Axis::z >, SimpleQuadric > | operator() (SimpleQuadric const &) const |
Simple quadric with near-zero terms can be another second-order surface. More... | |
Optional< SimpleQuadric, GeneralQuadric > | operator() (GeneralQuadric const &) const |
Quadric can be regularized or simplified. More... | |
template<class S > | |
std::variant< std::monostate > | operator() (S const &) const |
Default: no simplification. | |
template<Axis T> | |
auto | operator() (PlaneAligned< T > const &p) const -> Optional< PlaneAligned< T >> |
Plane may be snapped to origin. | |
template<Axis T> | |
auto | operator() (CylAligned< T > const &c) const -> Optional< CylCentered< T >> |
Cylinder at origin will be simplified. More... | |
template<Axis T> | |
auto | operator() (ConeAligned< T > const &c) const -> Optional< ConeAligned< T >> |
A cone whose origin is close to any axis will be snapped to it. More... | |
Return a simplified, regularized version of a surface/sense pair.
This class takes a general surface with an associated sense and will simplify (e.g., turning a general plane into an axis-aligned one) and regularize (e.g., flipping normals so that the plane points in a positive direction) it, modifying the sense as needed.
It is meant to be used with VariantSurface
to visit a surface type.
The result of each simplification type should be a std::variant
of possible simplified class forms, or a std::monostate
if no simplification was applied.
Tolerance
object instead of a single tolerance, and compare implementations with SoftSurfaceEqual
for consistency. auto celeritas::SurfaceSimplifier::operator() | ( | ConeAligned< T > const & | c | ) | const -> Optional<ConeAligned<T>> |
A cone whose origin is close to any axis will be snapped to it.
This uses a 1-norm for simplicity.
auto celeritas::SurfaceSimplifier::operator() | ( | CylAligned< T > const & | c | ) | const -> Optional<CylCentered<T>> |
Cylinder at origin will be simplified.
distance({0,0}, {u,v}) < tol sqrt(u^2 + v^2) < tol u^2 + v^2 < tol^2
auto celeritas::SurfaceSimplifier::operator() | ( | GeneralQuadric const & | gq | ) | const |
Quadric can be regularized or simplified.
auto celeritas::SurfaceSimplifier::operator() | ( | SimpleQuadric const & | sq | ) | const |
Simple quadric with near-zero terms can be another second-order surface.
The sign can also be reversed as part of regularization.