31#if defined(BoundedLatticePolytope_RECURSES)
32#error Recursive header files inclusion detected in BoundedLatticePolytope.h
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"
72 template <
typename TSpace >
129 :
dims( l.begin(), l.end() ) {}
142 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
156 :
dims( l.begin(), l.end() ) {}
169 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
183 :
dims( l.begin(), l.end() ) {}
196 for (
Dimension i = 0; i <
object.dims.size(); ++i ) out <<
object.
dims[ i ];
238 template <
typename Po
intIterator>
260 template <
typename HalfSpaceIterator>
262 HalfSpaceIterator itB, HalfSpaceIterator itE,
263 bool valid_edge_constraints =
false,
264 bool check_duplicate_constraints =
false );
285 template <
typename HalfSpaceIterator>
287 HalfSpaceIterator itB, HalfSpaceIterator itE,
288 bool valid_edge_constraints =
false,
289 bool check_duplicate_constraints =
false );
304 template <
typename Po
intIterator>
305 bool init( PointIterator itB, PointIterator itE );
367 const std::vector<bool>&
getI()
const;
450 bool valid_edge_constraint =
false );
469 bool valid_edge_constraint =
false );
668 template <
typename Po
intSet>
687 template <
typename Po
intSet>
801 template <
typename Po
intSet>
885 template <DGtal::Dimension N,
typename TInteger>
908 const std::vector<Point>& )
910 trace.
error() <<
"[BoundedLatticePolytopeHelper::addEdgeConstraint]"
911 <<
" this method is only implemented in 3D." << std::endl;
919 trace.
error() <<
"[BoundedLatticePolytopeHelper::crossProduct]"
920 <<
" this method is only implemented in 3D." << std::endl;
932 template <
typename TInteger>
952 const std::vector<Point>& pts )
954 Vector ab = pts[ i ] - pts[ j ];
955 for (
int s = 0; s < 2; s++ )
960 std::size_t nb_in = 0;
961 for (
auto p : pts ) {
963 if ( v < b ) nb_in++;
965 if ( nb_in == pts.size() - 2 ) {
966 P.
cut( n, b,
true,
true );
991 template <
typename TSpace>
1002 template <
typename TSpace>
1015 template <
typename TSpace>
1027 template <
typename TSpace>
1039 template <
typename TSpace>
1051 template <
typename TSpace>
1063 template <
typename TSpace>
1075 template <
typename TSpace>
1087#include "BoundedLatticePolytope.ih"
1094#undef BoundedLatticePolytope_RECURSES
Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer c...
void init(const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
Self & operator*=(Integer t)
Integer countWithin(Point low, Point hi) const
void getInteriorPoints(std::vector< Point > &pts) const
Integer countBoundary() const
unsigned int nbHalfSpaces() const
BoundedLatticePolytope(PointIterator itB, PointIterator itE)
void getInteriorPointsByScanning(std::vector< Point > &pts) const
bool isInside(const Point &p) const
Integer countByScanning() const
BoundedLatticePolytope(const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
Integer getB(unsigned int i) const
BoundedLatticePolytope(const Self &other)=default
Self & operator+=(UnitCell c)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
BoundedLatticePolytope()=default
Integer countInteriorByScanning() const
void getKPoints(std::vector< Point > &pts, const Point &alpha_shift) const
void clear()
Clears the polytope.
unsigned int cut(Dimension k, bool pos, Integer b, bool large=true)
ClosedIntegerHalfPlane< Space > HalfSpace
Integer countUpToByScanning(Integer max) const
void swap(BoundedLatticePolytope &other)
std::vector< bool > I
Are inequalities large ?
bool isLarge(unsigned int i) const
unsigned int cut(const Vector &a, Integer b, bool large=true, bool valid_edge_constraint=false)
std::vector< Vector > InequalityMatrix
bool init(PointIterator itB, PointIterator itE)
bool internalInitFromSegment2D(Point a, Point b)
const InequalityVector & getB() const
~BoundedLatticePolytope()=default
Self & operator+=(LeftStrictUnitCell c)
BoundedLatticePolytope interiorPolytope() const
unsigned int cut(const HalfSpace &hs, bool large=true, bool valid_edge_constraint=false)
Integer countBoundaryByScanning() const
std::vector< Integer > InequalityVector
BoundedLatticePolytope< TSpace > Self
bool internalInitFromTriangle3D(Point a, Point b, Point c)
void getBoundaryPoints(std::vector< Point > &pts) const
Integer countWithinByScanning(Point low, Point hi) const
InequalityMatrix A
The matrix A in the polytope representation .
bool isBoundary(const Point &p) const
const Domain & getDomain() const
void getPointsByScanning(std::vector< Point > &pts) const
void selfDisplay(std::ostream &out) const
Self & operator+=(RightStrictUnitCell c)
const Vector & getA(unsigned int i) const
const std::vector< bool > & getI() const
DGtal::BigInteger BigInteger
HyperRectDomain< Space > Domain
void insertKPoints(PointSet &pts_set, const Point &alpha_shift) const
void getBoundaryPointsByScanning(std::vector< Point > &pts) const
std::string className() const
bool internalInitFromSegment3D(Point a, Point b)
Integer countUpTo(Integer max) const
Domain D
Tight bounded box.
Self & operator+=(RightStrictUnitSegment s)
bool isDomainPointInside(const Point &p) const
Self & operator+=(LeftStrictUnitSegment s)
static const Dimension dimension
Self & operator+=(UnitSegment s)
BoundedLatticePolytope(std::initializer_list< Point > l)
bool myValidEdgeConstraints
Indicates if Minkowski sums with segments will be valid.
const InequalityMatrix & getA() const
Self & operator=(const Self &other)=default
BoundedLatticePolytope closurePolytope() const
Integer countInterior() const
bool isInterior(const Point &p) const
void insertPointsByScanning(PointSet &pts_set) const
void insertPoints(PointSet &pts_set) const
void getPoints(std::vector< Point > &pts) const
InequalityVector B
The vector B in the polytope representation .
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.
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.
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
mpz_class BigInteger
Multi-precision integer with GMP implementation.
std::vector< Dimension > dims
friend std::ostream & operator<<(std::ostream &out, const LeftStrictUnitCell &object)
LeftStrictUnitCell(std::initializer_list< Dimension > l)
LeftStrictUnitSegment(Dimension d)
std::vector< Dimension > dims
RightStrictUnitCell(std::initializer_list< Dimension > l)
friend std::ostream & operator<<(std::ostream &out, const RightStrictUnitCell &object)
RightStrictUnitSegment(Dimension d)
std::vector< Dimension > dims
friend std::ostream & operator<<(std::ostream &out, const UnitCell &object)
UnitCell(std::initializer_list< Dimension > l)
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 void addEdgeConstraint(Polytope &P, unsigned int i, unsigned int j, const std::vector< Point > &pts)
BoundedLatticePolytope< Space > Polytope
SpaceND< 3, Integer > Space
static Vector crossProduct(const Vector &v1, const Vector &v2)
Aim: It is just a helper class for BoundedLatticePolytope to add dimension specific static methods.
static Vector crossProduct(const Vector &, const Vector &)
static void addEdgeConstraint(Polytope &, unsigned int, unsigned int, const std::vector< Point > &)
SpaceND< N, Integer > Space
static const Dimension dimension
BoundedLatticePolytope< Space > Polytope