politopix  4.1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NormalFan_Rn.h
Go to the documentation of this file.
1 // politopix allows to make computations on polytopes such as finding vertices, intersecting, Minkowski sums, ...
2 // Copyright (C) 2011-2015 : Delos Vincent
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
19 // I2M (UMR CNRS 5295 / University of Bordeaux)
20 
21 #ifndef NORMALFAN_Rn
22 #define NORMALFAN_Rn
23 
24 #include <boost/shared_ptr.hpp>
25 #include <stdexcept>
26 #include <exception>
27 #include <iostream>
28 #include <vector>
29 #include "Rn.h"
30 #include "Generator_Rn.h"
31 #include "HalfSpace_Rn.h"
32 #include "Polytope_Rn.h"
33 
34 
38  friend class constIteratorOfListOfPolyhedralCones;
39 
40  public:
43 
45  NormalFan_Rn(const boost::shared_ptr<Polytope_Rn>& A);
46 
49 
51  unsigned int numberOfPolyhedralCones() const {return _listOfPolyhedralCones.size();}
52 
54  void addPolyhedralCone(boost::shared_ptr<PolyhedralCone_Rn> hs) {_listOfPolyhedralCones.push_back(hs);}
55 
57  void addVertex(boost::shared_ptr<Generator_Rn> vx) {_listOfVertices.push_back(vx);}
58 
59  const std::vector< boost::shared_ptr<Generator_Rn> >& getListOfGenerators() const {return _listOfVertices;}
60 
61  const std::vector< boost::shared_ptr<PolyhedralCone_Rn> >& getListOfPolyhedralCones() const {return _listOfPolyhedralCones;}
62 
63 
64  // CHECK POLYHEDRON
65 
66  bool checkTopologyAndGeometry() const throw (std::domain_error);
67 
68 
69  // ALGORITHMS
70 
77  void computeCommonRefinement(const NormalFan_Rn& NA, const NormalFan_Rn& NB);
78 
79  void computeHyperplanesSeparationForProjection(const std::vector< boost::shared_ptr<HalfSpace_Rn> >&, boost::shared_ptr<Polytope_Rn>& );
80 
82  void dump(std::ostream& out) const;
83 
84  protected:
86  std::vector< boost::shared_ptr<PolyhedralCone_Rn> > _listOfPolyhedralCones;
88  std::vector< boost::shared_ptr<Generator_Rn> > _listOfVertices;
89 };
90 
91 #endif // NORMALFAN_Rn
void addPolyhedralCone(boost::shared_ptr< PolyhedralCone_Rn > hs)
Add the current half-space in its list.
Definition: NormalFan_Rn.h:54
Model a polytope using its two equivalent definitions : the convex hull and the half-space intersecti...
Definition: Polytope_Rn.h:34
A half-space whose frontier is a linear (n-1) dimension space. _constant + _coefficients[0].x1 + ... + _coefficients[n-1].xn >= 0.
Definition: HalfSpace_Rn.h:37
Model a polyhedral cone using its two equivalent definitions : the convex hull and the half-space int...
void addVertex(boost::shared_ptr< Generator_Rn > vx)
Add the current vertex in its list.
Definition: NormalFan_Rn.h:57
~NormalFan_Rn()
Destructor.
Definition: NormalFan_Rn.h:48
const std::vector< boost::shared_ptr< PolyhedralCone_Rn > > & getListOfPolyhedralCones() const
Definition: NormalFan_Rn.h:61
const std::vector< boost::shared_ptr< Generator_Rn > > & getListOfGenerators() const
Definition: NormalFan_Rn.h:59
A n-coordinates generator, which can be a vertex or an edge whether it is contained by a polytope or ...
Definition: Generator_Rn.h:38
#define polito_EXPORT
Definition: polito_Export.h:15
Model a normal fan.
Definition: NormalFan_Rn.h:37
NormalFan_Rn()
Constructor.
Definition: NormalFan_Rn.h:42
unsigned int numberOfPolyhedralCones() const
Get the total number of polyhedral cones.
Definition: NormalFan_Rn.h:51