31 #if defined(BoundedRationalPolytope_RECURSES)
32 #error Recursive header files inclusion detected in BoundedRationalPolytope.h
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>
217 template <
typename HalfSpaceIterator>
220 HalfSpaceIterator itB, HalfSpaceIterator itE,
221 bool valid_edge_constraints =
false,
222 bool check_duplicate_constraints =
false );
250 template <
typename HalfSpaceIterator>
252 HalfSpaceIterator itB, HalfSpaceIterator itE,
253 bool valid_edge_constraints =
false,
254 bool check_duplicate_constraints =
false );
273 template <
typename Po
intIterator>
341 const std::vector<bool>&
getI()
const;
427 bool valid_edge_constraint =
false );
446 bool valid_edge_constraint =
false );
596 template <
typename Po
intSet>
699 template <DGtal::Dimension N,
typename TInteger>
722 const std::vector<Point>& )
724 trace.
error() <<
"[BoundedRationalPolytopeHelper::addEdgeConstraint]"
725 <<
" this method is only implemented in 3D." << std::endl;
733 trace.
error() <<
"[BoundedRationalPolytopeHelper::crossProduct]"
734 <<
" this method is only implemented in 3D." << std::endl;
746 template <
typename TInteger>
766 const std::vector<Point>& pts )
768 Vector ab = pts[ i ] - pts[ j ];
769 for (
int s = 0; s < 2; s++ )
774 std::size_t nb_in = 0;
775 for (
auto p : pts ) {
777 if ( v < b ) nb_in++;
780 P.
cut( n, b,
true,
true );
805 template <
typename TSpace>
816 template <
typename TSpace>
826 template <
typename TSpace>
839 template <
typename TSpace>
851 template <
typename TSpace>
863 #include "BoundedRationalPolytope.ih"
870 #undef BoundedRationalPolytope_RECURSES
Aim: Represents an nD rational polytope, i.e. a convex polyhedron bounded by vertices with rational c...
BoundedRationalPolytope< TSpace > Self
unsigned int cut(const Vector &a, Integer b, bool large=true, bool valid_edge_constraint=false)
Domain computeRationalDomain(const Domain &d)
Integer denominator() const
Integer countUpTo(Integer max) const
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
BoundedRationalPolytope()
const InequalityMatrix & getA() const
bool isLarge(unsigned int i) const
~BoundedRationalPolytope()=default
const InequalityVector & getB() const
bool internalInitFromSegment3D(Point a, Point b)
void swap(BoundedRationalPolytope &other)
bool init(Integer d, PointIterator itB, PointIterator itE)
void selfDisplay(std::ostream &out) const
Self & operator+=(UnitCell c)
Integer countInterior() const
BoundedRationalPolytope(std::initializer_list< Point > l)
Self & operator*=(Integer t)
void insertPoints(PointSet &pts_set) const
Self & operator=(const Self &other)=default
bool isBoundary(const Point &p) const
static const Dimension dimension
Integer getB(unsigned int i) const
HyperRectDomain< Space > Domain
void init(Integer d, const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
bool isDomainPointInside(const Point &p) const
const std::vector< bool > & getI() const
void getInteriorPoints(std::vector< Point > &pts) const
Self & operator*=(Rational r)
void clear()
Clears the polytope.
const Domain & getRationalDomain() const
DGtal::BigInteger BigInteger
std::string className() const
unsigned int cut(Dimension k, bool pos, Integer b, bool large=true)
void getBoundaryPoints(std::vector< Point > &pts) const
bool internalInitFromTriangle3D(Point a, Point b, Point c)
bool isInside(const Point &p) const
unsigned int cut(const HalfSpace &hs, bool large=true, bool valid_edge_constraint=false)
unsigned int nbHalfSpaces() const
void getPoints(std::vector< Point > &pts) const
const Domain & getLatticeDomain() const
bool internalInitFromSegment2D(Point a, Point b)
BoundedRationalPolytope interiorPolytope() const
Integer countWithin(Point low, Point hi) const
Integer countBoundary() const
std::vector< Integer > InequalityVector
Self & operator+=(UnitSegment s)
const Vector & getA(unsigned int i) const
BoundedRationalPolytope(const Self &other)=default
BoundedRationalPolytope(Integer d, const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
Domain computeLatticeDomain(const Domain &d)
bool myValidEdgeConstraints
ClosedIntegerHalfPlane< Space > HalfSpace
std::vector< Vector > InequalityMatrix
bool isInterior(const Point &p) const
BoundedRationalPolytope(Integer d, PointIterator itB, PointIterator itE)
const Domain & getDomain() const
static Self base(Dimension k, Component val=1)
auto crossProduct(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v))
Cross product with a PointVector.
static Self zero
Static const for zero PointVector.
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
static const Dimension dimension
static constants to store the dimension.
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::uint32_t Dimension
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
Rational(Integer a, Integer b)
UnitCell(std::initializer_list< Dimension > l)
friend std::ostream & operator<<(std::ostream &out, const UnitCell &object)
std::vector< Dimension > dims
Aim: A half-space specified by a vector N and a constant c. The half-space is the set .
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
static Vector crossProduct(const Vector &v1, const Vector &v2)
SpaceND< 3, Integer > Space
static void addEdgeConstraint(Polytope &P, unsigned int i, unsigned int j, const std::vector< Point > &pts)
BoundedRationalPolytope< Space > Polytope
Aim: It is just a helper class for BoundedRationalPolytope to add dimension specific static methods.
static void addEdgeConstraint(Polytope &, unsigned int, unsigned int, const std::vector< Point > &)
SpaceND< N, Integer > Space
BoundedRationalPolytope< Space > Polytope
static Vector crossProduct(const Vector &, const Vector &)
static const Dimension dimension