Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
Public Member Functions | List of all members
mc::domains::PolyTope< dim > Class Template Reference

Convex polytope (convex polyhedron) integration domain. More...

#include <polytope.hpp>

Inheritance diagram for mc::domains::PolyTope< dim >:
Collaboration diagram for mc::domains::PolyTope< dim >:

Public Member Functions

 PolyTope (const std::vector< geom::Point< dim > > &vertices, const std::vector< std::array< double, dim > > &norms, const std::vector< double > &offs)
 Construct a polytope from vertices and facet constraints.
 
geom::Bounds< dimgetBounds () const override
 Get the axis-aligned bounding box containing the polytope.
 
double getBoxVolume () const override
 Get the volume of the axis-aligned bounding box.
 
bool isInside (const geom::Point< dim > &p) const override
 Test if a point is inside or on the boundary of the polytope.
 
- Public Member Functions inherited from mc::domains::IntegrationDomain< dim >
virtual ~IntegrationDomain ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Detailed Description

template<size_t dim>
class mc::domains::PolyTope< dim >

Convex polytope (convex polyhedron) integration domain.

Template Parameters
dimThe dimensionality of the space.

A polytope is the intersection of half-spaces defined by linear inequalities: normal_i · point + offset_i ≤ 0 for all facets i

where normal_i is an inward-pointing unit normal and offset_i is the constant term. This representation supports arbitrary convex polytopes with any number of facets.

Note
For efficiency, ensure normals are normalized and offsets are accurate.
Typically generated using Qhull (Qt Qx Fn flags).

Definition at line 34 of file polytope.hpp.

Constructor & Destructor Documentation

◆ PolyTope()

template<size_t dim>
mc::domains::PolyTope< dim >::PolyTope ( const std::vector< geom::Point< dim > > &  vertices,
const std::vector< std::array< double, dim > > &  norms,
const std::vector< double > &  offs 
)

Construct a polytope from vertices and facet constraints.

Parameters
verticesVector of vertices (corners) of the polytope. Used only for computing the bounding box.
normsVector of inward-pointing normal vectors; one per facet. Each normal is an array of dim coefficients.
offsVector of offset values (constant terms); one per facet.
Exceptions
std::runtime_errorif norms and offs have different sizes, or if vertices is empty.
Note
norms.size() must equal offs.size() (number of facets).

Member Function Documentation

◆ getBounds()

template<size_t dim>
geom::Bounds< dim > mc::domains::PolyTope< dim >::getBounds ( ) const
overridevirtual

Get the axis-aligned bounding box containing the polytope.

Returns
Bounds<dim> with min/max coordinates in each dimension, computed from the vertex set.

Implements mc::domains::IntegrationDomain< dim >.

◆ getBoxVolume()

template<size_t dim>
double mc::domains::PolyTope< dim >::getBoxVolume ( ) const
overridevirtual

Get the volume of the axis-aligned bounding box.

Returns
Product of side lengths: ∏(max_i - min_i)

Used for Monte Carlo weight normalization in sampling.

Implements mc::domains::IntegrationDomain< dim >.

◆ isInside()

template<size_t dim>
bool mc::domains::PolyTope< dim >::isInside ( const geom::Point< dim > &  p) const
overridevirtual

Test if a point is inside or on the boundary of the polytope.

Parameters
pThe point to test.
Returns
true if normal_i · p + offset_i ≤ (tol) for all facets i; false otherwise (point violates at least one constraint).
Note
Applies a small numerical tolerance (1e-12) for robustness.

Implements mc::domains::IntegrationDomain< dim >.


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