An object of the class Polytope_distance_d<Traits> represents the (squared) distance between two convex polytopes, given as the convex hulls of two finite point sets in -dimensional Euclidean space . For point sets and we denote by the distance between the convex hulls of and . Note that can be degenerate, i.e. if or is empty.
Two inclusion-minimal subsets of and of with are called pair of support sets, the points in and are the support points. A pair of support sets has size at most (by size we mean ). The distance between the two polytopes is realized by a pair of points and lying in the convex hull of and , repectively, i.e. . In general, neither the support sets nor the realizing points are necessarily unique.
The underlying algorithm can cope with all kinds of input, e.g. and may be in non-convex position or points may occur more than once. The algorithm computes a pair of support sets and with realizing points and which remain fixed until the next set, insert, or clear operation.
#include <CGAL/Polytope_distance_d.h>
The template parameter Traits is a model for OptimisationDTraits.
We provide the models Optimisation_d_traits_2, Optimisation_d_traits_3, and Optimisation_d_traits_d using the two-, three-, and -dimensional CGAL kernel, respectively.
| |
typedef to Traits::Point_d.
Point type used to represent the input points.
| |
| |
typedef to Traits::FT.
Number type used to return the squared distance
between the two polytopes.
| |
| |
typedef to Traits::ET.
Number type used to do the exact computations in the underlying
solver for quadratic programs (cf. Implementation).
| |
| |
non-mutable model of the STL concept RandomAccessIterator
with value type Point. Used to access the points
of the two polytopes.
| |
| |
non-mutable model of the STL concept RandomAccessIterator
with value type Point. Used to access the support points.
| |
| |
non-mutable model of the STL concept RandomAccessIterator
with value type int. Used to access the indices of the
support points in the provided input order (starting from 0
in both point sets).
| |
| |
non-mutable model of the STL concept RandomAccessIterator
with value type ET. Used to access the coordinates of
the realizing points.
|
| |||||
initializes poly_dist to ØØ.
| |||||
| |||||
| |||||
initializes poly_dist to with and being the
sets of points in the range [p_first,p_last) and
[q_first,q_last), respectively.
|
advanced |
advanced |
|
| returns the dimension of the points in and . If poly_dist is ØØ, the ambient dimension is . |
|
| returns the number of all points of poly_dist, i.e. . |
|
| returns the number of points in . |
|
| returns the number of points in . |
|
| |
returns the number of support points of poly_dist, i.e. . | ||
|
| |
returns the number of support points in . | ||
|
| |
returns the number of support points in . |
|
| returns an iterator referring to the first point in . |
|
| returns the corresponding past-the-end iterator. |
|
| returns an iterator referring to the first point in . |
|
| returns the corresponding past-the-end iterator. |
|
| |||
returns an iterator referring to the first coordinate of the
realizing point of .
| ||||
|
| |||
returns the corresponding past-the-end iterator. |
|
| |||
returns an iterator referring to the first coordinate of the
realizing point of .
| ||||
|
| |||
returns the corresponding past-the-end iterator. | ||||
|
| |||
returns the numerator of the squared distance of poly_dist. | ||||
|
| |||
returns the denominator of the squared distance of poly_dist. |
|
| returns true, if is finite, i.e. none of the two polytopes is empty. |
|
| returns true, if is zero, i.e. the two polytopes intersect (this implies degeneracy). |
|
| returns true, iff is degenerate, i.e. is not finite. |
|
| resets poly_dist to ØØ. | ||||
| ||||||
|
| |||||
sets poly_dist to with and being the sets of
points in the ranges [p_first,p_last) and
[q_first,q_last), respectively.
| ||||||
| ||||||
|
| |||||
sets poly_dist to with being the set of points
in the range [p_first,p_last) ( remains unchanged).
| ||||||
| ||||||
|
| |||||
sets poly_dist to with being the set of points
in the range [q_first,q_last) ( remains unchanged).
| ||||||
|
|
inserts p into .
| ||||
|
|
inserts q into .
| ||||
| ||||||
|
| |||||
inserts the points in the range [p_first,p_last)
and [q_first,q_last) into and , respectively,
and recomputes the (squared) distance.
| ||||||
| ||||||
|
| |||||
inserts the points in the range [p_first,p_last) into
and recomputes the (squared) distance ( remains unchanged).
| ||||||
| ||||||
|
| |||||
inserts the points in the range [q_first,q_last) into
and recomputes the (squared) distance ( remains unchanged).
|
An object poly_dist is valid, iff ...
|
| |
returns true, iff poly_dist is valid. If verbose is true, some messages concerning the performed checks are written to standard error stream. The second parameter level is not used, we provide it only for consistency with interfaces of other classes. |
|
| returns a const reference to the traits class object. |
|
|
writes poly_dist to output stream os.
| ||
|
|
reads poly_dist from input stream is.
|
CGAL::Optimisation_d_traits_2<K,ET,NT>
CGAL::Optimisation_d_traits_3<K,ET,NT>
CGAL::Optimisation_d_traits_d<K,ET,NT>
OptimisationDTraits
The problem of finding the distance between two convex polytopes given as the convex hulls of two finite point sets can be formulated as an optimization problem with linear constraints and a convex quadratic objective function. The solution is obtained using our exact solver for quadratic programs [GS00].
The creation time is almost always linear in the number of points. Access functions and predicates take constant time, inserting a point might take up to linear time. The clear operation and the check for validity each take linear time.