31 #if defined(BoundedRationalPolytope_RECURSES)
32 #error Recursive header files inclusion detected in BoundedRationalPolytope.h
33 #else // defined(BoundedRationalPolytope_RECURSES)
35 #define BoundedRationalPolytope_RECURSES
37 #if !defined BoundedRationalPolytope_h
39 #define BoundedRationalPolytope_h
47 #include "DGtal/base/Common.h"
48 #include "DGtal/kernel/CSpace.h"
49 #include "DGtal/kernel/domains/HyperRectDomain.h"
50 #include "DGtal/arithmetic/IntegerComputer.h"
51 #include "DGtal/arithmetic/ClosedIntegerHalfPlane.h"
73 template <
typename TSpace >
88 #ifdef WITH_BIGINTEGER
112 :
dims( l.begin(), l.end() ) {}
125 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
188 template <
typename Po
intIterator>
211 template <
typename HalfSpaceIterator>
214 HalfSpaceIterator itB, HalfSpaceIterator itE,
215 bool valid_edge_constraints =
false );
237 template <
typename HalfSpaceIterator>
239 HalfSpaceIterator itB, HalfSpaceIterator itE,
240 bool valid_edge_constraints =
false );
260 template <
typename Po
intIterator>
328 const std::vector<bool>&
getI()
const;
414 bool valid_edge_constraint =
false );
433 bool valid_edge_constraint =
false );
583 template <
typename Po
intSet>
686 template <DGtal::Dimension N,
typename TInteger>
709 const std::vector<Point>& )
711 trace.
error() <<
"[BoundedRationalPolytopeHelper::addEdgeConstraint]"
712 <<
" this method is only implemented in 3D." << std::endl;
720 trace.
error() <<
"[BoundedRationalPolytopeHelper::crossProduct]"
721 <<
" this method is only implemented in 3D." << std::endl;
733 template <
typename TInteger>
753 const std::vector<Point>& pts )
755 Vector ab = pts[ i ] - pts[ j ];
756 for (
int s = 0; s < 2; s++ )
762 for (
auto p : pts ) {
764 if ( v < b ) nb_in++;
767 P.
cut( n, b,
true,
true );
792 template <
typename TSpace>
803 template <
typename TSpace>
813 template <
typename TSpace>
826 template <
typename TSpace>
838 template <
typename TSpace>
850 #include "BoundedRationalPolytope.ih"
855 #endif // !defined BoundedRationalPolytope_h
857 #undef BoundedRationalPolytope_RECURSES
858 #endif // else defined(BoundedRationalPolytope_RECURSES)
mpz_class BigInteger
Multi-precision integer with GMP implementation.
const Vector & getA(unsigned int i) const
bool isInterior(const Point &p) const
SpaceND< 3, Integer > Space
static Self zero
Static const for zero PointVector.
Aim: It is just a helper class for BoundedRationalPolytope to add dimension specific static methods.
Rational(Integer a, Integer b)
bool isLarge(unsigned int i) const
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Self & operator=(const Self &other)=default
bool internalInitFromSegment3D(Point a, Point b)
void getInteriorPoints(std::vector< Point > &pts) const
UnitCell(std::initializer_list< Dimension > l)
bool init(Integer d, PointIterator itB, PointIterator itE)
bool isDomainPointInside(const Point &p) const
static const Dimension dimension
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
Integer countUpTo(Integer max) const
Integer countInterior() const
DGtal::uint32_t Dimension
const InequalityMatrix & getA() const
bool isInside(const Point &p) const
static void addEdgeConstraint(Polytope &, unsigned int, unsigned int, const std::vector< Point > &)
BoundedRationalPolytope< TSpace > Self
static const Dimension dimension
BoundedRationalPolytope(const Self &other)=default
unsigned int nbHalfSpaces() const
BoundedRationalPolytope()
HyperRectDomain< Space > Domain
static Self base(Dimension k, Component val=1)
std::vector< Integer > InequalityVector
auto crossProduct(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v))
Cross product with a PointVector.
friend std::ostream & operator<<(std::ostream &out, const UnitCell &object)
Self & operator*=(Rational r)
std::vector< Vector > InequalityMatrix
const Domain & getLatticeDomain() const
Integer getB(unsigned int i) const
void selfDisplay(std::ostream &out) const
static Vector crossProduct(const Vector &, const Vector &)
Domain computeLatticeDomain(const Domain &d)
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
BoundedRationalPolytope(Integer d, const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false)
SpaceND< N, Integer > Space
DGtal is the top-level namespace which contains all DGtal functions and types.
void swap(BoundedRationalPolytope &other)
BoundedRationalPolytope< Space > Polytope
void getBoundaryPoints(std::vector< Point > &pts) const
unsigned int cut(const Vector &a, Integer b, bool large=true, bool valid_edge_constraint=false)
const Domain & getDomain() const
static const Dimension dimension
static constants to store the dimension.
std::vector< Dimension > dims
void init(Integer d, const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false)
~BoundedRationalPolytope()=default
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Integer denominator() const
static Vector crossProduct(const Vector &v1, const Vector &v2)
void insertPoints(PointSet &pts_set) const
BoundedRationalPolytope(std::initializer_list< Point > l)
Aim: A half-space specified by a vector N and a constant c. The half-space is the set .
Aim: Represents an nD rational polytope, i.e. a convex polyhedron bounded by vertices with rational c...
DGtal::BigInteger BigInteger
bool isBoundary(const Point &p) const
std::string className() const
Integer countBoundary() const
ClosedIntegerHalfPlane< Space > HalfSpace
Self & operator*=(Integer t)
Self & operator+=(UnitCell c)
bool internalInitFromTriangle3D(Point a, Point b, Point c)
Integer countWithin(Point low, Point hi) const
void getPoints(std::vector< Point > &pts) const
Self & operator+=(UnitSegment s)
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
boost::int64_t int64_t
signed 94-bit integer.
BoundedRationalPolytope(Integer d, PointIterator itB, PointIterator itE)
unsigned int cut(const HalfSpace &hs, bool large=true, bool valid_edge_constraint=false)
const std::vector< bool > & getI() const
bool internalInitFromSegment2D(Point a, Point b)
const Domain & getRationalDomain() const
BoundedRationalPolytope< Space > Polytope
unsigned int cut(Dimension k, bool pos, Integer b, bool large=true)
Domain computeRationalDomain(const Domain &d)
bool myValidEdgeConstraints
BoundedRationalPolytope interiorPolytope() const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
void clear()
Clears the polytope.
const InequalityVector & getB() const
static void addEdgeConstraint(Polytope &P, unsigned int i, unsigned int j, const std::vector< Point > &pts)