irafhy
Interval arithmetic based Reachability Analysis Framework for Hybrid Automaton
irafhy::Polytope Class Reference

#include <polytope.h>

Inheritance diagram for irafhy::Polytope:
Inheritance graph
Collaboration diagram for irafhy::Polytope:
Collaboration graph

Public Member Functions

 Polytope ()
 constructor More...
 
 Polytope (const Polytope &polytope)=default
 copy constructor More...
 
 Polytope (Polytope &&polytope) noexcept=default
 move constructor More...
 
 Polytope (const std::vector< Point > &points)
 constructor with given points More...
 
 Polytope (const std::vector< HalfSpace > &halfSpaces)
 constructor with given half spaces More...
 
 Polytope (const std::vector< capd::interval > &constraints)
 constructor with given interval constraints More...
 
 Polytope (const capd::C0Rect2Set &set)
 constructor with given state set More...
 
 Polytope (const Point &center, double radius)
 constructor with given center and related radius More...
 
 Polytope (const Eigen::VectorXd &center, double radius)
 constructor with given coordinate of the center and related radius More...
 
 ~Polytope () override=default
 destructor More...
 
std::vector< PointpointConstraints () const
 get the extreme vertices of the polytope More...
 
std::vector< HalfSpacehalfSpaceConstraints () const
 get the half space constraints of the polytope More...
 
Point centroid () const
 get the centroid of the polytope More...
 
std::vector< capd::interval > constraints () const
 get the variance constraints of all dimensions More...
 
bool empty () const override
 check if the polytope is empty or not More...
 
int dimension () const override
 get the dimension of the space which the polytope in More...
 
double volume () const
 get the volume of the polytope More...
 
bool intersect (const Polytope &rhs, Polytope &result) const override
 check if the current polytope intersect with the given right hand side one or not More...
 
Polytope unite (const Polytope &rhs) const override
 get the union of the current polytope and the given right hand side one More...
 
bool contains (const Point &point) const override
 check if the given point inside the domain which defined by the current polytope or not More...
 
bool contains (const Eigen::VectorXd &coordinate) const override
 check if the given coordinate inside the domain which defined by the current polytope or not More...
 
Polytopeoperator= (const Polytope &rhs)=default
 assignment operator More...
 
Polytopeoperator= (Polytope &&rhs) noexcept=default
 assignment operator More...
 
- Public Member Functions inherited from irafhy::Geometry< Polytope >
virtual ~Geometry ()=default
 destructor More...
 

Static Public Member Functions

static Polytope Empty (std::size_t dimension=0)
 static constructor of Empty polytope More...
 

Private Member Functions

 Polytope (const std::vector< Point > &pointConstraints, const std::vector< HalfSpace > &halfSpaceConstraints, double volume, int dimension)
 constructor with given constraints and related information More...
 
void init (const convexConstraints &constraints)
 initialize the polytope with given convex hull More...
 
std::vector< PointverticesEnumerationDualPly (const std::vector< HalfSpace > &halfSpaces)
 enumerate vertices using dual polytope method More...
 
std::vector< PointverticesEnumerationIntersect (const std::vector< HalfSpace > &halfSpaces)
 enumerate vertices using intersection computation More...
 
std::vector< PointverticesEnumeration (const std::vector< capd::interval > &constraints)
 enumerate extreme vertices with given constraints in interval form More...
 
std::vector< PointverticesEnumeration (const Eigen::VectorXd &center, double radius)
 enumerate extreme vertices with given center coordinate and related radius More...
 

Private Attributes

std::vector< PointpointConstraints_
 point constraints which define the convex hull entity More...
 
std::vector< HalfSpacehalfSpaceConstraints_
 half spaces constraints which define the convex hull entity More...
 
double volume_ = 0.0
 volume of the convex hull More...
 
int dimension_ = 0
 dimension of the space which current convex hull in More...
 

Constructor & Destructor Documentation

◆ Polytope() [1/10]

irafhy::Polytope::Polytope ( const std::vector< Point > &  pointConstraints,
const std::vector< HalfSpace > &  halfSpaceConstraints,
double  volume,
int  dimension 
)
private

constructor with given constraints and related information

Parameters
pointConstraintspoint constraints of the convex hull entity
halfSpaceConstraintshalf spaces constraints of the convex hull entity
volumevolume of the convex hull
dimensiondimension of the space which the polytope in

References dimension(), dimension_, halfSpaceConstraints(), halfSpaceConstraints_, pointConstraints(), pointConstraints_, volume(), and volume_.

Here is the call graph for this function:

◆ Polytope() [2/10]

irafhy::Polytope::Polytope ( )

constructor

References dimension_, halfSpaceConstraints_, pointConstraints_, and volume_.

Referenced by Empty(), intersect(), and unite().

◆ Polytope() [3/10]

irafhy::Polytope::Polytope ( const Polytope polytope)
default

copy constructor

Parameters
polytopegiven polytope

◆ Polytope() [4/10]

irafhy::Polytope::Polytope ( Polytope &&  polytope)
defaultnoexcept

move constructor

Parameters
polytopegiven polytope

◆ Polytope() [5/10]

irafhy::Polytope::Polytope ( const std::vector< Point > &  points)
explicit

constructor with given points

Parameters
pointsgiven points

References irafhy::ConvexHull::constraints(), dimension_, halfSpaceConstraints_, init(), pointConstraints_, and volume_.

Here is the call graph for this function:

◆ Polytope() [6/10]

irafhy::Polytope::Polytope ( const std::vector< HalfSpace > &  halfSpaces)
explicit

constructor with given half spaces

Parameters
halfSpacesgiven half spaces

References irafhy::ConvexHull::constraints(), dimension(), dimension_, halfSpaceConstraints_, init(), pointConstraints_, verticesEnumerationIntersect(), and volume_.

Here is the call graph for this function:

◆ Polytope() [7/10]

irafhy::Polytope::Polytope ( const std::vector< capd::interval > &  constraints)
explicit

constructor with given interval constraints

Parameters
constraintsgiven interval constraints

References irafhy::ConvexHull::constraints(), dimension_, halfSpaceConstraints_, init(), pointConstraints_, verticesEnumeration(), and volume_.

Here is the call graph for this function:

◆ Polytope() [8/10]

irafhy::Polytope::Polytope ( const capd::C0Rect2Set &  set)
explicit

constructor with given state set

Parameters
setgiven state set

References dimension(), dimension_, halfSpaceConstraints_, pointConstraints_, and volume_.

Here is the call graph for this function:

◆ Polytope() [9/10]

irafhy::Polytope::Polytope ( const Point center,
double  radius 
)

constructor with given center and related radius

Parameters
centercenter of the polytope
radiusradius which defines the variance of each dimension

References irafhy::ConvexHull::constraints(), irafhy::Point::coordinate(), init(), and verticesEnumeration().

Here is the call graph for this function:

◆ Polytope() [10/10]

irafhy::Polytope::Polytope ( const Eigen::VectorXd &  center,
double  radius 
)

constructor with given coordinate of the center and related radius

Parameters
centercoordinate of the center of the polytope
radiusradius which defines the variance of each dimension

References irafhy::ConvexHull::constraints(), init(), and verticesEnumeration().

Here is the call graph for this function:

◆ ~Polytope()

irafhy::Polytope::~Polytope ( )
overridedefault

destructor

Member Function Documentation

◆ centroid()

Point irafhy::Polytope::centroid ( ) const

get the centroid of the polytope

Returns
the centroid of the polytope in Point form

References pointConstraints_.

◆ constraints()

std::vector< capd::interval > irafhy::Polytope::constraints ( ) const

get the variance constraints of all dimensions

Returns
variance constraints in interval vector form

References dimension_, and pointConstraints_.

Referenced by irafhy::CSPSolver::branchPruneSolve().

◆ contains() [1/2]

bool irafhy::Polytope::contains ( const Point point) const
overridevirtual

check if the given point inside the domain which defined by the current polytope or not

Parameters
pointgiven point
Returns
TRUE if the given point inside the domain which defined by the current polytope

Implements irafhy::Geometry< Polytope >.

References halfSpaceConstraints_.

Referenced by intersect().

◆ contains() [2/2]

bool irafhy::Polytope::contains ( const Eigen::VectorXd &  coordinate) const
overridevirtual

check if the given coordinate inside the domain which defined by the current polytope or not

Parameters
coordinategiven coordinate
Returns
TRUE if the given coordinate inside the domain which defined by the current polytope

Implements irafhy::Geometry< Polytope >.

References halfSpaceConstraints_.

◆ dimension()

int irafhy::Polytope::dimension ( ) const
overridevirtual

get the dimension of the space which the polytope in

Returns
the dimension of the space which the polytope in

Implements irafhy::Geometry< Polytope >.

References dimension_.

Referenced by irafhy::CSPSolver::branchPruneSolve(), Empty(), irafhy::operator<<(), Polytope(), verticesEnumerationDualPly(), and verticesEnumerationIntersect().

◆ Empty()

Polytope irafhy::Polytope::Empty ( std::size_t  dimension = 0)
static

static constructor of Empty polytope

Parameters
dimensiondimension of the space which the polytope in
Returns
resulting Empty polytope

References dimension(), irafhy::HalfSpace::Empty(), Polytope(), and irafhy::Point::zero().

Referenced by irafhy::Condition::Empty(), and intersect().

Here is the call graph for this function:

◆ empty()

bool irafhy::Polytope::empty ( ) const
overridevirtual

check if the polytope is empty or not

Returns
TRUE if the polytope has zero volume or empty convex hull constraints

Implements irafhy::Geometry< Polytope >.

References halfSpaceConstraints_, pointConstraints_, and volume_.

Referenced by irafhy::CSPSolver::branchPruneSolve(), and intersect().

◆ halfSpaceConstraints()

std::vector< HalfSpace > irafhy::Polytope::halfSpaceConstraints ( ) const

get the half space constraints of the polytope

Returns
half space constraints of the polytope

References halfSpaceConstraints_.

Referenced by irafhy::CSPSolver::branchPruneSolve(), intersect(), irafhy::operator<<(), and Polytope().

◆ init()

void irafhy::Polytope::init ( const convexConstraints constraints)
private

initialize the polytope with given convex hull

Parameters
constraints

References irafhy::convexConstraints::dimension(), dimension_, irafhy::convexConstraints::halfSpaceConstraints(), halfSpaceConstraints_, irafhy::convexConstraints::pointConstraints(), pointConstraints_, irafhy::convexConstraints::volume(), and volume_.

Referenced by Polytope().

Here is the call graph for this function:

◆ intersect()

bool irafhy::Polytope::intersect ( const Polytope rhs,
Polytope result 
) const
overridevirtual

check if the current polytope intersect with the given right hand side one or not

Parameters
rhsright hand side polytope
resultintersection of two polytope if exist
Returns
TRUE if the intersection of two polytope isn't empty

Implements irafhy::Geometry< Polytope >.

References contains(), dimension_, Empty(), empty(), halfSpaceConstraints(), halfSpaceConstraints_, pointConstraints(), pointConstraints_, and Polytope().

Here is the call graph for this function:

◆ operator=() [1/2]

Polytope& irafhy::Polytope::operator= ( const Polytope rhs)
default

assignment operator

Parameters
rhsright hand side polytope
Returns
resulting polytope

◆ operator=() [2/2]

Polytope& irafhy::Polytope::operator= ( Polytope &&  rhs)
defaultnoexcept

assignment operator

Parameters
rhsright hand side polytope
Returns
resulting polytope

◆ pointConstraints()

std::vector< Point > irafhy::Polytope::pointConstraints ( ) const

get the extreme vertices of the polytope

Returns
extreme vertices of the polytope

References pointConstraints_.

Referenced by intersect(), irafhy::operator<<(), Polytope(), and unite().

◆ unite()

Polytope irafhy::Polytope::unite ( const Polytope rhs) const
overridevirtual

get the union of the current polytope and the given right hand side one

Parameters
rhsright hand side polytope
Returns
resulting union of two polytope

Implements irafhy::Geometry< Polytope >.

References pointConstraints(), and Polytope().

Here is the call graph for this function:

◆ verticesEnumeration() [1/2]

std::vector< Point > irafhy::Polytope::verticesEnumeration ( const std::vector< capd::interval > &  constraints)
private

enumerate extreme vertices with given constraints in interval form

Parameters
constraintsgiven space constraints
Returns
resulting extreme vertices of the target domain defined by the given constraints

Referenced by Polytope().

◆ verticesEnumeration() [2/2]

std::vector< Point > irafhy::Polytope::verticesEnumeration ( const Eigen::VectorXd &  center,
double  radius 
)
private

enumerate extreme vertices with given center coordinate and related radius

Parameters
centercoordinate of the target domain
radiusgiven radius
Returns
resulting extreme vertices of the target domain defined by the given center and related radius

◆ verticesEnumerationDualPly()

std::vector< Point > irafhy::Polytope::verticesEnumerationDualPly ( const std::vector< HalfSpace > &  halfSpaces)
private

enumerate vertices using dual polytope method

Parameters
halfSpacesgiven half spaces
Returns
resulting extreme vertices of the target domain defined by the given half spaces

References irafhy::ConvexHull::constraints(), dimension(), and irafhy::convexConstraints::faceVerticesIdx().

Here is the call graph for this function:

◆ verticesEnumerationIntersect()

std::vector< Point > irafhy::Polytope::verticesEnumerationIntersect ( const std::vector< HalfSpace > &  halfSpaces)
private

enumerate vertices using intersection computation

Parameters
halfSpacesgiven half spaces
Returns
resulting extreme vertices of the target domain defined by the given half spaces

References dimension(), and matplotlibcpp::fill().

Referenced by Polytope().

Here is the call graph for this function:

◆ volume()

double irafhy::Polytope::volume ( ) const

get the volume of the polytope

Returns
the volume of the polytope

References volume_.

Referenced by irafhy::operator<<(), and Polytope().

Member Data Documentation

◆ dimension_

int irafhy::Polytope::dimension_ = 0
private

dimension of the space which current convex hull in

Referenced by constraints(), dimension(), init(), intersect(), and Polytope().

◆ halfSpaceConstraints_

std::vector<HalfSpace> irafhy::Polytope::halfSpaceConstraints_
private

half spaces constraints which define the convex hull entity

Referenced by contains(), empty(), halfSpaceConstraints(), init(), intersect(), and Polytope().

◆ pointConstraints_

std::vector<Point> irafhy::Polytope::pointConstraints_
private

point constraints which define the convex hull entity

Referenced by centroid(), constraints(), empty(), init(), intersect(), pointConstraints(), and Polytope().

◆ volume_

double irafhy::Polytope::volume_ = 0.0
private

volume of the convex hull

Referenced by empty(), init(), Polytope(), and volume().


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