DGtal 1.3.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Static Public Attributes | Protected Attributes | Private Member Functions
DGtal::BoundedLatticePolytope< TSpace > Class Template Reference

Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer coordinates, as a set of inequalities. Otherwise said, it is a H-representation of a polytope (as an intersection of half-spaces). A limitation is that we model only bounded polytopes, i.e. polytopes that can be included in a finite bounding box. More...

#include <DGtal/geometry/volumes/BoundedLatticePolytope.h>

Data Structures

struct  LeftStrictUnitCell
 
struct  LeftStrictUnitSegment
 
struct  RightStrictUnitCell
 
struct  RightStrictUnitSegment
 
struct  UnitCell
 
struct  UnitSegment
 

Public Types

typedef BoundedLatticePolytope< TSpace > Self
 
typedef TSpace Space
 
typedef Space::Integer Integer
 
typedef Space::Point Point
 
typedef Space::Vector Vector
 
typedef std::vector< VectorInequalityMatrix
 
typedef std::vector< IntegerInequalityVector
 
typedef HyperRectDomain< SpaceDomain
 
typedef ClosedIntegerHalfPlane< SpaceHalfSpace
 
typedef DGtal::BigInteger BigInteger
 

Public Member Functions

Standard services (construction, initialization, assignment, interior, closure)
 ~BoundedLatticePolytope ()=default
 
 BoundedLatticePolytope ()=default
 
 BoundedLatticePolytope (const Self &other)=default
 
 BoundedLatticePolytope (std::initializer_list< Point > l)
 
template<typename PointIterator >
 BoundedLatticePolytope (PointIterator itB, PointIterator itE)
 
template<typename HalfSpaceIterator >
 BoundedLatticePolytope (const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
 
template<typename HalfSpaceIterator >
void init (const Domain &domain, HalfSpaceIterator itB, HalfSpaceIterator itE, bool valid_edge_constraints=false, bool check_duplicate_constraints=false)
 
template<typename PointIterator >
bool init (PointIterator itB, PointIterator itE)
 
Selfoperator= (const Self &other)=default
 
void clear ()
 Clears the polytope. More...
 
BoundedLatticePolytope interiorPolytope () const
 
BoundedLatticePolytope closurePolytope () const
 
Accessor services
const DomaingetDomain () const
 
unsigned int nbHalfSpaces () const
 
const VectorgetA (unsigned int i) const
 
Integer getB (unsigned int i) const
 
bool isLarge (unsigned int i) const
 
const InequalityMatrixgetA () const
 
const InequalityVectorgetB () const
 
const std::vector< bool > & getI () const
 
bool canBeSummed () const
 
Check point services (is inside test)
bool isInside (const Point &p) const
 
bool isDomainPointInside (const Point &p) const
 
bool isInterior (const Point &p) const
 
bool isBoundary (const Point &p) const
 
Global modification services (cut, swap, Minkowski sum)
unsigned int cut (Dimension k, bool pos, Integer b, bool large=true)
 
unsigned int cut (const Vector &a, Integer b, bool large=true, bool valid_edge_constraint=false)
 
unsigned int cut (const HalfSpace &hs, bool large=true, bool valid_edge_constraint=false)
 
void swap (BoundedLatticePolytope &other)
 
Selfoperator*= (Integer t)
 
Selfoperator+= (UnitSegment s)
 
Selfoperator+= (UnitCell c)
 
Selfoperator+= (RightStrictUnitSegment s)
 
Selfoperator+= (RightStrictUnitCell c)
 
Selfoperator+= (LeftStrictUnitSegment s)
 
Selfoperator+= (LeftStrictUnitCell c)
 
Enumeration services (counting, get points in polytope)
Integer count () const
 
Integer countInterior () const
 
Integer countBoundary () const
 
Integer countWithin (Point low, Point hi) const
 
Integer countUpTo (Integer max) const
 
void getPoints (std::vector< Point > &pts) const
 
void getKPoints (std::vector< Point > &pts, const Point &alpha_shift) const
 
void getInteriorPoints (std::vector< Point > &pts) const
 
void getBoundaryPoints (std::vector< Point > &pts) const
 
template<typename PointSet >
void insertPoints (PointSet &pts_set) const
 
template<typename PointSet >
void insertKPoints (PointSet &pts_set, const Point &alpha_shift) const
 
Enumeration services by scanning (counting, get points in polytope)
Integer countByScanning () const
 
Integer countInteriorByScanning () const
 
Integer countBoundaryByScanning () const
 
Integer countWithinByScanning (Point low, Point hi) const
 
Integer countUpToByScanning (Integer max) const
 
void getPointsByScanning (std::vector< Point > &pts) const
 
void getInteriorPointsByScanning (std::vector< Point > &pts) const
 
void getBoundaryPointsByScanning (std::vector< Point > &pts) const
 
template<typename PointSet >
void insertPointsByScanning (PointSet &pts_set) const
 
Interface services
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 

Static Public Attributes

static const Dimension dimension = Space::dimension
 

Protected Attributes

InequalityMatrix A
 The matrix A in the polytope representation \( Ax \le B \). More...
 
InequalityVector B
 The vector B in the polytope representation \( Ax \le B \). More...
 
Domain D
 Tight bounded box. More...
 
std::vector< bool > I
 Are inequalities large ? More...
 
bool myValidEdgeConstraints
 Indicates if Minkowski sums with segments will be valid. More...
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >))
 
bool internalInitFromTriangle3D (Point a, Point b, Point c)
 
bool internalInitFromSegment3D (Point a, Point b)
 
bool internalInitFromSegment2D (Point a, Point b)
 

Detailed Description

template<typename TSpace>
class DGtal::BoundedLatticePolytope< TSpace >

Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer coordinates, as a set of inequalities. Otherwise said, it is a H-representation of a polytope (as an intersection of half-spaces). A limitation is that we model only bounded polytopes, i.e. polytopes that can be included in a finite bounding box.

Description of template class 'BoundedLatticePolytope'

It is a model of boost::CopyConstructible, boost::DefaultConstructible, boost::Assignable.

Template Parameters
TSpacean arbitrary model of CSpace.

Definition at line 73 of file BoundedLatticePolytope.h.

Member Typedef Documentation

◆ BigInteger

template<typename TSpace >
typedef DGtal::BigInteger DGtal::BoundedLatticePolytope< TSpace >::BigInteger

Definition at line 88 of file BoundedLatticePolytope.h.

◆ Domain

template<typename TSpace >
typedef HyperRectDomain< Space > DGtal::BoundedLatticePolytope< TSpace >::Domain

Definition at line 85 of file BoundedLatticePolytope.h.

◆ HalfSpace

template<typename TSpace >
typedef ClosedIntegerHalfPlane< Space > DGtal::BoundedLatticePolytope< TSpace >::HalfSpace

Definition at line 86 of file BoundedLatticePolytope.h.

◆ InequalityMatrix

template<typename TSpace >
typedef std::vector<Vector> DGtal::BoundedLatticePolytope< TSpace >::InequalityMatrix

Definition at line 83 of file BoundedLatticePolytope.h.

◆ InequalityVector

template<typename TSpace >
typedef std::vector<Integer> DGtal::BoundedLatticePolytope< TSpace >::InequalityVector

Definition at line 84 of file BoundedLatticePolytope.h.

◆ Integer

template<typename TSpace >
typedef Space::Integer DGtal::BoundedLatticePolytope< TSpace >::Integer

Definition at line 80 of file BoundedLatticePolytope.h.

◆ Point

template<typename TSpace >
typedef Space::Point DGtal::BoundedLatticePolytope< TSpace >::Point

Definition at line 81 of file BoundedLatticePolytope.h.

◆ Self

template<typename TSpace >
typedef BoundedLatticePolytope<TSpace> DGtal::BoundedLatticePolytope< TSpace >::Self

Definition at line 78 of file BoundedLatticePolytope.h.

◆ Space

template<typename TSpace >
typedef TSpace DGtal::BoundedLatticePolytope< TSpace >::Space

Definition at line 79 of file BoundedLatticePolytope.h.

◆ Vector

template<typename TSpace >
typedef Space::Vector DGtal::BoundedLatticePolytope< TSpace >::Vector

Definition at line 82 of file BoundedLatticePolytope.h.

Constructor & Destructor Documentation

◆ ~BoundedLatticePolytope()

template<typename TSpace >
DGtal::BoundedLatticePolytope< TSpace >::~BoundedLatticePolytope ( )
default

Destructor.

◆ BoundedLatticePolytope() [1/5]

template<typename TSpace >
DGtal::BoundedLatticePolytope< TSpace >::BoundedLatticePolytope ( )
default

Constructor.

◆ BoundedLatticePolytope() [2/5]

template<typename TSpace >
DGtal::BoundedLatticePolytope< TSpace >::BoundedLatticePolytope ( const Self other)
default

Copy constructor.

Parameters
otherthe object to clone.

◆ BoundedLatticePolytope() [3/5]

template<typename TSpace >
DGtal::BoundedLatticePolytope< TSpace >::BoundedLatticePolytope ( std::initializer_list< Point l)

Constructs the polytope from a simplex given as an initializer_list.

Parameters
lany list of no more than d+1 points in general positions.

◆ BoundedLatticePolytope() [4/5]

template<typename TSpace >
template<typename PointIterator >
DGtal::BoundedLatticePolytope< TSpace >::BoundedLatticePolytope ( PointIterator  itB,
PointIterator  itE 
)

Constructs the polytope from a simplex given as a range [itB,itE) of lattice points.

Template Parameters
PointIteratorany model of forward iterator on Point.
Parameters
itBthe start of the range of no more than n+1 points defining the simplex.
itEpast the end the range of no more than n+1 points defining the simplex.

◆ BoundedLatticePolytope() [5/5]

template<typename TSpace >
template<typename HalfSpaceIterator >
DGtal::BoundedLatticePolytope< TSpace >::BoundedLatticePolytope ( const Domain domain,
HalfSpaceIterator  itB,
HalfSpaceIterator  itE,
bool  valid_edge_constraints = false,
bool  check_duplicate_constraints = false 
)

Constructs a polytope from a domain and a collection of half-spaces.

Template Parameters
HalfSpaceIteratorany model of forward iterator on HalfSpace.
Parameters
domaina bounded lattice domain.
itBthe start of the range of half-spaces.
itEpast the end of the range of half-spaces.
valid_edge_constraintswhen 'true', tells that there are half-spaces that represents th constraints on edges (n-2 cells) lying between two faces (n-1 cells) pointing to different orthants.
check_duplicate_constraintswhen 'true', the initialization checks if the given range of half-spaces contains axis-aligned half-space constraints already defined by the domain and if so it merges the duplicated constraints, otherwise it accepts and stores the constraints as is.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TSpace >
DGtal::BoundedLatticePolytope< TSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CSpace< TSpace >)  )
private

◆ canBeSummed()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::canBeSummed ( ) const
Returns
'true' if we can perform exact Minkowksi sums on this polytope. This is related to the presence of valid edge constraints (n-k cells for k >= 2) in-between face constraints (n-1 cells) that change orthants.

◆ className()

template<typename TSpace >
std::string DGtal::BoundedLatticePolytope< TSpace >::className ( ) const
Returns
the class name. It is notably used for drawing this object.

◆ clear()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::clear ( )

Clears the polytope.

◆ closurePolytope()

template<typename TSpace >
BoundedLatticePolytope DGtal::BoundedLatticePolytope< TSpace >::closurePolytope ( ) const
Returns
the closure (in the topological sense) of this polytope, by making all constraints large.

◆ count()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::count ( ) const

Computes the number of integer points lying within the polytope.

Returns
the number of integer points lying within the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter

Referenced by DGtal::EhrhartPolynomial< TSpace, TInteger >::init().

◆ countBoundary()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countBoundary ( ) const

Computes the number of integer points lying on the boundary of the polytope.

Returns
the number of integer points lying on the boundary of the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter
count() <= countInterior() + countBoundary() with equality when the polytope is closed.

◆ countBoundaryByScanning()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countBoundaryByScanning ( ) const

Computes the number of integer points lying on the boundary of the polytope.

Returns
the number of integer points lying on the boundary of the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.
count() <= countInterior() + countBoundary() with equality when the polytope is closed.

◆ countByScanning()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countByScanning ( ) const

Computes the number of integer points lying within the polytope.

Returns
the number of integer points lying within the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.

◆ countInterior()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countInterior ( ) const

Computes the number of integer points lying within the interior of the polytope.

Returns
the number of integer points lying within the interior of the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter
count() <= countInterior() + countBoundary() with equality when the polytope is closed.

◆ countInteriorByScanning()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countInteriorByScanning ( ) const

Computes the number of integer points lying within the interior of the polytope.

Returns
the number of integer points lying within the interior of the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.
count() <= countInterior() + countBoundary() with equality when the polytope is closed.

◆ countUpTo()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countUpTo ( Integer  max) const

Computes the number of integer points within the polytope up to some maximum number max.

Note
For instance, a d-dimensional simplex that contains no integer points in its interior contains only d+1 points. If there is more, you know that the simplex has a non empty interior.
Parameters
[in]maxthe maximum number of points that are counted, the method exists when this number of reached.
Returns
the number of integer points within the polytope up to .
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter

◆ countUpToByScanning()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countUpToByScanning ( Integer  max) const

Computes the number of integer points within the polytope up to some maximum number max.

Note
For instance, a d-dimensional simplex that contains no integer points in its interior contains only d+1 points. If there is more, you know that the simplex has a non empty interior.
Parameters
[in]maxthe maximum number of points that are counted, the method exists when this number of reached.
Returns
the number of integer points within the polytope up to .
Note
Quite slow: obtained by checking every point of the polytope domain.

◆ countWithin()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countWithin ( Point  low,
Point  hi 
) const

Computes the number of integer points within the polytope and the domain bounded by low and hi.

Parameters
[in]lowthe lowest point of the domain.
[in]hithe highest point of the domain.
Returns
the number of integer points within the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter

◆ countWithinByScanning()

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::countWithinByScanning ( Point  low,
Point  hi 
) const

Computes the number of integer points within the polytope and the domain bounded by low and hi.

Parameters
[in]lowthe lowest point of the domain.
[in]hithe highest point of the domain.
Returns
the number of integer points within the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.

◆ cut() [1/3]

template<typename TSpace >
unsigned int DGtal::BoundedLatticePolytope< TSpace >::cut ( const HalfSpace hs,
bool  large = true,
bool  valid_edge_constraint = false 
)

Cuts the lattice polytope with the given half-space constraint.

Parameters
hsany half-space constraint.
largetells if the inequality is large (true) or strict (false).
valid_edge_constraintwhen 'true', tells that the half-spaces that represents constraints on edges (n-2 cells) lying between two faces (n-1 cells) pointing to different orthants are still valid after this operation.
Returns
the index of the constraint in the polytope.
Note
For now complexity is O(n) where n=A.rows() because it checks if a parallel closed half-space defines already a face of the polytope.

◆ cut() [2/3]

template<typename TSpace >
unsigned int DGtal::BoundedLatticePolytope< TSpace >::cut ( const Vector a,
Integer  b,
bool  large = true,
bool  valid_edge_constraint = false 
)

Cut the polytope by the given half space a.x <= b or a.x < b.

Parameters
aany integer vector
bany integer number
largetells if the inequality is large (true) or strict (false).
valid_edge_constraintwhen 'true', tells that the half-spaces that represents constraints on edges (n-2 cells) lying between two faces (n-1 cells) pointing to different orthants are still valid after this operation.
Returns
the index of the constraint in the polytope.
Note
For now complexity is O(n) where n=A.rows() because it checks if a parallel closed half-space defines already a face of the polytope.

◆ cut() [3/3]

template<typename TSpace >
unsigned int DGtal::BoundedLatticePolytope< TSpace >::cut ( Dimension  k,
bool  pos,
Integer  b,
bool  large = true 
)

Cut the polytope by the given half space a.x <= b or a.x < b where a is some axis vector.

Parameters
kthe dimension of the axis vector \( +/- e_k \)
pos'true' is positive, 'false' is negative for the axis vector \( +/- e_k \)
bany integer number
largetells if the inequality is large (true) or strict (false).
Returns
the index of the constraint in the polytope.

Referenced by DGtal::detail::BoundedLatticePolytopeSpecializer< 3, TInteger >::addEdgeConstraint().

◆ getA() [1/2]

template<typename TSpace >
const InequalityMatrix & DGtal::BoundedLatticePolytope< TSpace >::getA ( ) const
Returns
the matrix A in the polytope representation \( Ax \le B \).

◆ getA() [2/2]

template<typename TSpace >
const Vector & DGtal::BoundedLatticePolytope< TSpace >::getA ( unsigned int  i) const
Parameters
ithe index of the half-space constraint between 0 and nbHalfSpaces() (excluded).
Returns
the normal vector of the i-th half space constraint (i.e. A in constraint Ax <= b).

◆ getB() [1/2]

template<typename TSpace >
const InequalityVector & DGtal::BoundedLatticePolytope< TSpace >::getB ( ) const
Returns
the vector B in the polytope representation \( Ax \le B \).

◆ getB() [2/2]

template<typename TSpace >
Integer DGtal::BoundedLatticePolytope< TSpace >::getB ( unsigned int  i) const
Parameters
ithe index of the half-space constraint between 0 and nbHalfSpaces() (excluded).
Returns
the offset of the i-th half space constraint (i.e. b in constraint Ax <= b).

◆ getBoundaryPoints()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getBoundaryPoints ( std::vector< Point > &  pts) const

Computes the integer points boundary to the polytope.

Parameters
[out]ptsthe integer points boundary to the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter
At output, pts.size() == this->countBoundary()

◆ getBoundaryPointsByScanning()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getBoundaryPointsByScanning ( std::vector< Point > &  pts) const

Computes the integer points boundary to the polytope.

Parameters
[out]ptsthe integer points boundary to the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.
At output, pts.size() == this->countBoundary()

◆ getDomain()

template<typename TSpace >
const Domain & DGtal::BoundedLatticePolytope< TSpace >::getDomain ( ) const
Returns
the domain of the current polytope.

◆ getI()

template<typename TSpace >
const std::vector< bool > & DGtal::BoundedLatticePolytope< TSpace >::getI ( ) const
Returns
the vector I telling if inequalities are large in the polytope representation \( Ax \prec B \), with \( \prec \in \{ <, \le \} \).

◆ getInteriorPoints()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getInteriorPoints ( std::vector< Point > &  pts) const

Computes the integer points interior to the polytope.

Parameters
[out]ptsthe integer points interior to the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter
At output, pts.size() == this->countInterior()

◆ getInteriorPointsByScanning()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getInteriorPointsByScanning ( std::vector< Point > &  pts) const

Computes the integer points interior to the polytope.

Parameters
[out]ptsthe integer points interior to the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.
At output, pts.size() == this->countInterior()

◆ getKPoints()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getKPoints ( std::vector< Point > &  pts,
const Point alpha_shift 
) const

Computes the integer points within the polytope and converts them to cells represented with their Khalimsky coordinates.

Parameters
[out]ptsthe integer points within the polytope, with coordinates equal to 2*p - alpha_shift, for p in the polytope.
[in]alpha_shiftthe translation applied to each point.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter
At output, pts.size() == this->count()
Usefull for full convexity checks.

Referenced by SCENARIO().

◆ getPoints()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getPoints ( std::vector< Point > &  pts) const

Computes the integer points within the polytope.

Parameters
[out]ptsthe integer points within the polytope.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter
At output, pts.size() == this->count()
Examples
geometry/volumes/checkFullConvexityTheorems.cpp.

Referenced by checkCvxHPlusHypercubeFullConvexity(), checkFullConvexityCharacterization(), and SCENARIO().

◆ getPointsByScanning()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::getPointsByScanning ( std::vector< Point > &  pts) const

Computes the integer points within the polytope.

Parameters
[out]ptsthe integer points within the polytope.
Note
Quite slow: obtained by checking every point of the polytope domain.
At output, pts.size() == this->count()

◆ init() [1/2]

template<typename TSpace >
template<typename HalfSpaceIterator >
void DGtal::BoundedLatticePolytope< TSpace >::init ( const Domain domain,
HalfSpaceIterator  itB,
HalfSpaceIterator  itE,
bool  valid_edge_constraints = false,
bool  check_duplicate_constraints = false 
)

Initializes a polytope from a domain and a vector of half-spaces.

Template Parameters
HalfSpaceIteratorany model of forward iterator on HalfSpace.
Parameters
domaina bounded lattice domain.
itBthe start of the range of half-spaces.
itEpast the end of the range of half-spaces.
valid_edge_constraintswhen 'true', tells that there are half-spaces that represents the constraints on edges (n-2 cells) lying between two faces (n-1 cells) pointing to different orthants.
check_duplicate_constraintswhen 'true', the initialization checks if the given range of half-spaces contains axis-aligned half-space constraints already defined by the domain and if so it merges the duplicated constraints, otherwise it accepts and stores the constraints as is.

◆ init() [2/2]

template<typename TSpace >
template<typename PointIterator >
bool DGtal::BoundedLatticePolytope< TSpace >::init ( PointIterator  itB,
PointIterator  itE 
)

Initializes the polytope from a simplex given as a range [itB,itE) of points.

Parameters
itBthe start of the range of no more than n+1 points defining the simplex.
itEpast the end the range of no more than n+1 points defining the simplex.
Returns
'true' if [itB,itE) was a valid simplex, otherwise return 'false' and the polytope is empty.
Note
Use DGtal SimpleMatrix::determinant which is not efficient when the dimension is high. Does not use Eigen to avoid dependency.

◆ insertKPoints()

template<typename TSpace >
template<typename PointSet >
void DGtal::BoundedLatticePolytope< TSpace >::insertKPoints ( PointSet &  pts_set,
const Point alpha_shift 
) const

Computes the integer points within the polytope and converts them to cells represented with their Khalimsky coordinates.

Template Parameters
PointSetany model of set with a method insert( Point ).
Parameters
[in,out]pts_setthe set of points where points within this polytope are inserted. Each point is inserted with coordinates equal to 2*p - alpha_shift, for p in the polytope.
[in]alpha_shiftthe translation applied to each point.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter

◆ insertPoints()

template<typename TSpace >
template<typename PointSet >
void DGtal::BoundedLatticePolytope< TSpace >::insertPoints ( PointSet &  pts_set) const

Computes the integer points within the polytope.

Template Parameters
PointSetany model of set with a method insert( Point ).
Parameters
[in,out]pts_setthe set of points where points within this polytope are inserted.
Note
Quite fast: obtained by line intersection, see BoundedLatticePolytopeCounter

◆ insertPointsByScanning()

template<typename TSpace >
template<typename PointSet >
void DGtal::BoundedLatticePolytope< TSpace >::insertPointsByScanning ( PointSet &  pts_set) const

Computes the integer points within the polytope.

Template Parameters
PointSetany model of set with a method insert( Point ).
Parameters
[in,out]pts_setthe set of points where points within this polytope are inserted.
Note
Quite slow: obtained by checking every point of the polytope domain.

◆ interiorPolytope()

template<typename TSpace >
BoundedLatticePolytope DGtal::BoundedLatticePolytope< TSpace >::interiorPolytope ( ) const
Returns
the interior (in the topological sense) of this polytope, by making all constraints strict.

◆ internalInitFromSegment2D()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::internalInitFromSegment2D ( Point  a,
Point  b 
)
private

In 2D, builds a valid lattice polytope with empty interior from 2 points.

Parameters
aany point
bany point
Returns
'true'

◆ internalInitFromSegment3D()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::internalInitFromSegment3D ( Point  a,
Point  b 
)
private

In 3D, builds a valid lattice polytope with empty interior from 2 points.

Parameters
aany point
bany point
Returns
'true'

◆ internalInitFromTriangle3D()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::internalInitFromTriangle3D ( Point  a,
Point  b,
Point  c 
)
private

In 3D, builds a valid lattice polytope with empty interior from 3 non-colinear points.

Parameters
aany point such that a, b, and c are not colinear.
bany point such that a, b, and c are not colinear.
cany point such that a, b, and c are not colinear.
Returns
'true' if they were not colinear, false otherwise.

◆ isBoundary()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::isBoundary ( const Point p) const
Parameters
pany point of the space.
Returns
'true' if and only if p lies on the boundary of this polytope.

◆ isDomainPointInside()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::isDomainPointInside ( const Point p) const
Parameters
pany point inside the domain of this polytope.
Returns
'true' if and only if p is inside this polytope.
Note
Slightly faster than isInside.

◆ isInside()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::isInside ( const Point p) const
Parameters
pany point of the space.
Returns
'true' if and only if p is inside this polytope.

◆ isInterior()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::isInterior ( const Point p) const
Parameters
pany point of the space.
Returns
'true' if and only if p is strictly inside this polytope.

◆ isLarge()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::isLarge ( unsigned int  i) const
Parameters
ithe index of the half-space constraint between 0 and nbHalfSpaces() (excluded).
Returns
'true' if the i-th half space constraint is of the form Ax <= b, 'false' if it is of the form Ax < b.

◆ isValid()

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::isValid ( ) const

Checks the validity/consistency of the object. If the polytope has been default constructed, it is invalid.

Returns
'true' if the object is valid, 'false' otherwise.

◆ nbHalfSpaces()

template<typename TSpace >
unsigned int DGtal::BoundedLatticePolytope< TSpace >::nbHalfSpaces ( ) const
Returns
the number of half-space constraints.

◆ operator*=()

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator*= ( Integer  t)

Dilates this polytope P by t.

Parameters
tany integer.
Returns
a reference to 'this', which is now the polytope tP.

◆ operator+=() [1/6]

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator+= ( LeftStrictUnitCell  c)

Minkowski sum of this polytope with an axis-aligned strict unit cell.

Parameters
cany strict unit cell.
Returns
a reference to 'this'.

◆ operator+=() [2/6]

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator+= ( LeftStrictUnitSegment  s)

Minkowski sum of this polytope with a strict unit segment aligned with some axis.

Parameters
sany strict unit segment.
Returns
a reference to 'this'.

◆ operator+=() [3/6]

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator+= ( RightStrictUnitCell  c)

Minkowski sum of this polytope with an axis-aligned strict unit cell.

Parameters
cany strict unit cell.
Returns
a reference to 'this'.

◆ operator+=() [4/6]

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator+= ( RightStrictUnitSegment  s)

Minkowski sum of this polytope with a strict unit segment aligned with some axis.

Parameters
sany strict unit segment.
Returns
a reference to 'this'.

◆ operator+=() [5/6]

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator+= ( UnitCell  c)

Minkowski sum of this polytope with an axis-aligned unit cell.

Parameters
cany unit cell.
Returns
a reference to 'this'.

◆ operator+=() [6/6]

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator+= ( UnitSegment  s)

Minkowski sum of this polytope with a unit segment aligned with some axis.

Parameters
sany unit segment.
Returns
a reference to 'this'.

◆ operator=()

template<typename TSpace >
Self & DGtal::BoundedLatticePolytope< TSpace >::operator= ( const Self other)
default

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ selfDisplay()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ swap()

template<typename TSpace >
void DGtal::BoundedLatticePolytope< TSpace >::swap ( BoundedLatticePolytope< TSpace > &  other)

Swaps the content of this object with other. O(1) complexity.

Parameters
otherany other BoundedLatticePolytope.

Field Documentation

◆ A

template<typename TSpace >
InequalityMatrix DGtal::BoundedLatticePolytope< TSpace >::A
protected

The matrix A in the polytope representation \( Ax \le B \).

Definition at line 836 of file BoundedLatticePolytope.h.

◆ B

template<typename TSpace >
InequalityVector DGtal::BoundedLatticePolytope< TSpace >::B
protected

The vector B in the polytope representation \( Ax \le B \).

Definition at line 838 of file BoundedLatticePolytope.h.

◆ D

template<typename TSpace >
Domain DGtal::BoundedLatticePolytope< TSpace >::D
protected

Tight bounded box.

Definition at line 840 of file BoundedLatticePolytope.h.

◆ dimension

template<typename TSpace >
const Dimension DGtal::BoundedLatticePolytope< TSpace >::dimension = Space::dimension
static

Definition at line 92 of file BoundedLatticePolytope.h.

◆ I

template<typename TSpace >
std::vector<bool> DGtal::BoundedLatticePolytope< TSpace >::I
protected

Are inequalities large ?

Definition at line 842 of file BoundedLatticePolytope.h.

◆ myValidEdgeConstraints

template<typename TSpace >
bool DGtal::BoundedLatticePolytope< TSpace >::myValidEdgeConstraints
protected

Indicates if Minkowski sums with segments will be valid.

Definition at line 844 of file BoundedLatticePolytope.h.


The documentation for this class was generated from the following file: