31 #if defined(BoundedLatticePolytope_RECURSES)
32 #error Recursive header files inclusion detected in BoundedLatticePolytope.h
33 #else // defined(BoundedLatticePolytope_RECURSES)
35 #define BoundedLatticePolytope_RECURSES
37 #if !defined BoundedLatticePolytope_h
39 #define BoundedLatticePolytope_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
130 :
dims( l.begin(), l.end() ) {}
143 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
157 :
dims( l.begin(), l.end() ) {}
170 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
184 :
dims( l.begin(), l.end() ) {}
197 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
239 template <
typename Po
intIterator>
255 template <
typename HalfSpaceIterator>
257 HalfSpaceIterator itB, HalfSpaceIterator itE,
258 bool valid_edge_constraints =
false );
273 template <
typename HalfSpaceIterator>
275 HalfSpaceIterator itB, HalfSpaceIterator itE,
276 bool valid_edge_constraints =
false );
291 template <
typename Po
intIterator>
292 bool init( PointIterator itB, PointIterator itE );
346 const std::vector<bool>&
getI()
const;
432 bool valid_edge_constraint =
false );
451 bool valid_edge_constraint =
false );
625 template <
typename Po
intSet>
709 template <DGtal::Dimension N,
typename TInteger>
732 const std::vector<Point>& )
734 trace.
error() <<
"[BoundedLatticePolytopeHelper::addEdgeConstraint]"
735 <<
" this method is only implemented in 3D." << std::endl;
743 trace.
error() <<
"[BoundedLatticePolytopeHelper::crossProduct]"
744 <<
" this method is only implemented in 3D." << std::endl;
756 template <
typename TInteger>
776 const std::vector<Point>& pts )
778 Vector ab = pts[ i ] - pts[ j ];
779 for (
int s = 0; s < 2; s++ )
785 for (
auto p : pts ) {
787 if ( v < b ) nb_in++;
789 if ( nb_in == pts.size() - 2 ) {
790 P.
cut( n, b,
true,
true );
815 template <
typename TSpace>
826 template <
typename TSpace>
839 template <
typename TSpace>
851 template <
typename TSpace>
863 template <
typename TSpace>
875 template <
typename TSpace>
887 template <
typename TSpace>
899 template <
typename TSpace>
911 #include "BoundedLatticePolytope.ih"
916 #endif // !defined BoundedLatticePolytope_h
918 #undef BoundedLatticePolytope_RECURSES
919 #endif // else defined(BoundedLatticePolytope_RECURSES)
mpz_class BigInteger
Multi-precision integer with GMP implementation.
UnitCell(std::initializer_list< Dimension > l)
Self & operator+=(LeftStrictUnitCell c)
BoundedLatticePolytope< Space > Polytope
static Self zero
Static const for zero PointVector.
static void addEdgeConstraint(Polytope &P, unsigned int i, unsigned int j, const std::vector< Point > &pts)
Integer countBoundary() const
void insertPoints(PointSet &pts_set) const
static void addEdgeConstraint(Polytope &, unsigned int, unsigned int, const std::vector< Point > &)
Integer countInterior() const
SpaceND< N, Integer > Space
BoundedLatticePolytope< TSpace > Self
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
bool isDomainPointInside(const Point &p) const
static const Dimension dimension
ClosedIntegerHalfPlane< Space > HalfSpace
bool myValidEdgeConstraints
Indicates if Minkowski sums with segments will be valid.
Domain D
Tight bounded box.
void getPoints(std::vector< Point > &pts) const
Integer countUpTo(Integer max) const
std::vector< bool > I
Are inequalities large ?
unsigned int cut(const HalfSpace &hs, bool large=true, bool valid_edge_constraint=false)
Integer getB(unsigned int i) const
const Vector & getA(unsigned int i) const
BoundedLatticePolytope interiorPolytope() const
std::vector< Dimension > dims
DGtal::uint32_t Dimension
friend std::ostream & operator<<(std::ostream &out, const LeftStrictUnitCell &object)
BoundedLatticePolytope(PointIterator itB, PointIterator itE)
Aim: It is just a helper class for BoundedLatticePolytope to add dimension specific static methods.
unsigned int cut(Dimension k, bool pos, Integer b, bool large=true)
void clear()
Clears the polytope.
void getBoundaryPoints(std::vector< Point > &pts) const
Self & operator+=(UnitCell c)
bool internalInitFromSegment3D(Point a, Point b)
BoundedLatticePolytope(const Self &other)=default
void init(const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false)
void selfDisplay(std::ostream &out) const
static Self base(Dimension k, Component val=1)
SpaceND< 3, Integer > Space
auto crossProduct(const PointVector< dim, OtherComponent, OtherStorage > &v) const -> decltype(DGtal::crossProduct(*this, v))
Cross product with a PointVector.
Integer countWithin(Point low, Point hi) const
HyperRectDomain< Space > Domain
bool isInside(const Point &p) const
Self & operator+=(LeftStrictUnitSegment s)
BoundedLatticePolytope(std::initializer_list< Point > l)
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
DGtal::BigInteger BigInteger
InequalityVector B
The vector B in the polytope representation .
std::vector< Integer > InequalityVector
Self & operator*=(Integer t)
DGtal is the top-level namespace which contains all DGtal functions and types.
static const Dimension dimension
BoundedLatticePolytope(const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false)
LeftStrictUnitSegment(Dimension d)
bool internalInitFromTriangle3D(Point a, Point b, Point c)
static Vector crossProduct(const Vector &, const Vector &)
static const Dimension dimension
static constants to store the dimension.
~BoundedLatticePolytope()=default
void getInteriorPoints(std::vector< Point > &pts) const
Self & operator+=(RightStrictUnitSegment s)
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Self & operator=(const Self &other)=default
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
Aim: A half-space specified by a vector N and a constant c. The half-space is the set .
void swap(BoundedLatticePolytope &other)
friend std::ostream & operator<<(std::ostream &out, const RightStrictUnitCell &object)
unsigned int nbHalfSpaces() const
bool isInterior(const Point &p) const
static Vector crossProduct(const Vector &v1, const Vector &v2)
BoundedLatticePolytope< Space > Polytope
bool isLarge(unsigned int i) const
Self & operator+=(RightStrictUnitCell c)
const std::vector< bool > & getI() const
const Domain & getDomain() const
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer c...
boost::int64_t int64_t
signed 94-bit integer.
std::vector< Dimension > dims
const InequalityMatrix & getA() const
InequalityMatrix A
The matrix A in the polytope representation .
bool init(PointIterator itB, PointIterator itE)
bool internalInitFromSegment2D(Point a, Point b)
BoundedLatticePolytope()=default
std::string className() const
bool isBoundary(const Point &p) const
Self & operator+=(UnitSegment s)
RightStrictUnitCell(std::initializer_list< Dimension > l)
std::vector< Vector > InequalityMatrix
const InequalityVector & getB() const
LeftStrictUnitCell(std::initializer_list< Dimension > l)
friend std::ostream & operator<<(std::ostream &out, const UnitCell &object)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
unsigned int cut(const Vector &a, Integer b, bool large=true, bool valid_edge_constraint=false)
RightStrictUnitSegment(Dimension d)
std::vector< Dimension > dims