politopix  5.0.0
VolumeOfPolytopes_Rn Class Reference

Split a polytope into simplices to compute its volume.
Two Algorithms for Determining Volumes of Convex Polyhedra (1979) by Jacques Cohen and Timothy Hickey
Journal of the ACM (JACM) JACM Homepage archive
Volume 26 Issue 3, july 1979
Pages 401-414
More...

#include <VolumeOfPolytopes_Rn.h>

Collaboration diagram for VolumeOfPolytopes_Rn:
Collaboration graph

Public Member Functions

 VolumeOfPolytopes_Rn (const boost::shared_ptr< Polytope_Rn > P)
 Constructor. More...
 
 ~VolumeOfPolytopes_Rn ()
 
void splitCloudOfVertices (unsigned int DIM)
 
void check () const
 
double volume ()
 Sum the volumes of all simplices partitionning the polytope. More...
 
double computeSimplexVolume (const std::set< boost::shared_ptr< Generator_Rn > > &listOfSimplexVertices) const
 
double determinant (boost::numeric::ublas::matrix< double > a) const
 
void dump (std::ostream &this_ostream)
 
void dumpDS (std::ostream &this_ostream) const
 
void dumpAllSimplices (std::ostream &this_ostream) const
 

Static Public Member Functions

static double compute (const boost::shared_ptr< Polytope_Rn > P)
 Return the volume of the given polytope P. More...
 

Protected Attributes

std::vector< std::vector< unsigned int > > _verticesByFacets
 The ordered list of all vertices stored by facets. More...
 
std::vector< std::vector< unsigned int > > _facetsByVertices
 The ordered list of all facets stored by vertices. More...
 
std::vector< PolytopeToSimplexes_allSimplices
 List to store all the simplices partitioning the polytope. More...
 
boost::shared_ptr< Polytope_Rn_polytope
 The current polytope we are working on. More...
 
double _volume
 The volume of the polytope. More...
 
unsigned int _dimension
 As the algorithm goes down in lower dimensions, we want to store the starting space dimension. More...
 
unsigned int _numberOfFacets
 The number of facets of the current polytope. More...
 
unsigned int _numberOfVertices
 The number of vertices of the current polytope. More...
 

Detailed Description

Split a polytope into simplices to compute its volume.
Two Algorithms for Determining Volumes of Convex Polyhedra (1979) by Jacques Cohen and Timothy Hickey
Journal of the ACM (JACM) JACM Homepage archive
Volume 26 Issue 3, july 1979
Pages 401-414

Definition at line 139 of file VolumeOfPolytopes_Rn.h.

Constructor & Destructor Documentation

◆ VolumeOfPolytopes_Rn()

VolumeOfPolytopes_Rn::VolumeOfPolytopes_Rn ( const boost::shared_ptr< Polytope_Rn P)

Constructor.

Definition at line 26 of file VolumeOfPolytopes_Rn.cpp.

Here is the call graph for this function:

◆ ~VolumeOfPolytopes_Rn()

VolumeOfPolytopes_Rn::~VolumeOfPolytopes_Rn ( )
inline

Definition at line 146 of file VolumeOfPolytopes_Rn.h.

Member Function Documentation

◆ check()

void VolumeOfPolytopes_Rn::check ( ) const

Definition at line 74 of file VolumeOfPolytopes_Rn.cpp.

◆ compute()

static double VolumeOfPolytopes_Rn::compute ( const boost::shared_ptr< Polytope_Rn P)
inlinestatic

Return the volume of the given polytope P.

Definition at line 153 of file VolumeOfPolytopes_Rn.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeSimplexVolume()

double VolumeOfPolytopes_Rn::computeSimplexVolume ( const std::set< boost::shared_ptr< Generator_Rn > > &  listOfSimplexVertices) const

Compute the volume of a simplex making use of the following formula : \( \displaystyle Vol \big( conv(v_0, ..., v_k) \big) = \frac{ \vert det( v_1-v_0, ..., v_k-v_0 ) \vert }{n!} \)

Definition at line 228 of file VolumeOfPolytopes_Rn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ determinant()

double VolumeOfPolytopes_Rn::determinant ( boost::numeric::ublas::matrix< double >  a) const

Called by computeSimplexVolume() to compute a square matrix determinant. As we run it on small matrices we just use the minors method.

Definition at line 247 of file VolumeOfPolytopes_Rn.cpp.

Here is the caller graph for this function:

◆ dump()

void VolumeOfPolytopes_Rn::dump ( std::ostream &  this_ostream)
inline

Definition at line 211 of file VolumeOfPolytopes_Rn.h.

Here is the caller graph for this function:

◆ dumpAllSimplices()

void VolumeOfPolytopes_Rn::dumpAllSimplices ( std::ostream &  this_ostream) const
inline

Definition at line 247 of file VolumeOfPolytopes_Rn.h.

◆ dumpDS()

void VolumeOfPolytopes_Rn::dumpDS ( std::ostream &  this_ostream) const
inline

Definition at line 227 of file VolumeOfPolytopes_Rn.h.

Here is the caller graph for this function:

◆ splitCloudOfVertices()

void VolumeOfPolytopes_Rn::splitCloudOfVertices ( unsigned int  DIM)

Build all simplices to partition the polytope.

Parameters
DIMthe dimension of the space we work in

Definition at line 81 of file VolumeOfPolytopes_Rn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ volume()

double VolumeOfPolytopes_Rn::volume ( )

Sum the volumes of all simplices partitionning the polytope.

Definition at line 194 of file VolumeOfPolytopes_Rn.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _allSimplices

std::vector< PolytopeToSimplexes > VolumeOfPolytopes_Rn::_allSimplices
protected

List to store all the simplices partitioning the polytope.

Definition at line 262 of file VolumeOfPolytopes_Rn.h.

◆ _dimension

unsigned int VolumeOfPolytopes_Rn::_dimension
protected

As the algorithm goes down in lower dimensions, we want to store the starting space dimension.

Definition at line 268 of file VolumeOfPolytopes_Rn.h.

◆ _facetsByVertices

std::vector< std::vector< unsigned int > > VolumeOfPolytopes_Rn::_facetsByVertices
protected

The ordered list of all facets stored by vertices.

Definition at line 260 of file VolumeOfPolytopes_Rn.h.

◆ _numberOfFacets

unsigned int VolumeOfPolytopes_Rn::_numberOfFacets
protected

The number of facets of the current polytope.

Definition at line 270 of file VolumeOfPolytopes_Rn.h.

◆ _numberOfVertices

unsigned int VolumeOfPolytopes_Rn::_numberOfVertices
protected

The number of vertices of the current polytope.

Definition at line 272 of file VolumeOfPolytopes_Rn.h.

◆ _polytope

boost::shared_ptr<Polytope_Rn> VolumeOfPolytopes_Rn::_polytope
protected

The current polytope we are working on.

Definition at line 264 of file VolumeOfPolytopes_Rn.h.

◆ _verticesByFacets

std::vector< std::vector< unsigned int > > VolumeOfPolytopes_Rn::_verticesByFacets
protected

The ordered list of all vertices stored by facets.

Definition at line 258 of file VolumeOfPolytopes_Rn.h.

◆ _volume

double VolumeOfPolytopes_Rn::_volume
protected

The volume of the polytope.

Definition at line 266 of file VolumeOfPolytopes_Rn.h.


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