DGtal
0.6.devel
|
#include <COBAGenericNaivePlane.h>
Public Types | |
typedef TSpace | Space |
typedef Space::Point | Point |
typedef std::set< Point > | PointSet |
typedef PointSet::size_type | Size |
typedef PointSet::const_iterator | ConstIterator |
typedef PointSet::iterator | Iterator |
typedef TInternalInteger | InternalInteger |
typedef IntegerComputer < InternalInteger > | MyIntegerComputer |
typedef PointSet::const_iterator | const_iterator |
typedef PointSet::const_pointer | const_pointer |
typedef PointSet::const_reference | const_reference |
typedef PointSet::value_type | value_type |
typedef PointSet::difference_type | difference_type |
typedef PointSet::size_type | size_type |
Public Member Functions | |
~COBAGenericNaivePlane () | |
COBAGenericNaivePlane () | |
COBAGenericNaivePlane (const COBAGenericNaivePlane &other) | |
COBAGenericNaivePlane & | operator= (const COBAGenericNaivePlane &other) |
MyIntegerComputer & | ic () const |
Dimension | active () const |
void | clear () |
void | init (InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE) |
Size | complexity () const |
Size | size () const |
bool | empty () const |
ConstIterator | begin () const |
ConstIterator | end () const |
Size | max_size () const |
Size | maxSize () const |
bool | operator() (const Point &p) const |
bool | extendAsIs (const Point &p) |
bool | extend (const Point &p) |
bool | isExtendable (const Point &p) const |
template<typename TInputIterator > | |
bool | extend (TInputIterator it, TInputIterator itE) |
template<typename TInputIterator > | |
bool | isExtendable (TInputIterator it, TInputIterator itE) const |
template<typename Vector3D > | |
void | getNormal (Vector3D &normal) const |
template<typename Vector3D > | |
void | getUnitNormal (Vector3D &normal) const |
void | getBounds (double &min, double &max) const |
const Point & | minimalPoint () const |
const Point & | maximalPoint () const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Types | |
typedef COBANaivePlane< Space, InternalInteger > | COBAComputer |
typedef std::vector< Dimension > ::iterator | AxisIterator |
typedef std::vector< Dimension > ::const_iterator | AxisConstIterator |
Private Member Functions | |
BOOST_CONCEPT_ASSERT ((CSpace< TSpace >)) | |
BOOST_CONCEPT_ASSERT ((CInteger< TInternalInteger >)) | |
BOOST_STATIC_ASSERT ((TSpace::dimension==3)) |
Private Attributes | |
std::vector< Dimension > | myAxes |
COBAComputer | myComputers [3] |
std::vector< Dimension > | _axesToErase |
Aim: A class that recognizes pieces of digital planes of given axis width. When the width is 1, it corresponds to naive planes. Contrary to COBANaivePlane, the axis is not specified at initialization of the object. This class uses three instances of COBANaivePlane, one per axis.
Description of template class 'COBAGenericNaivePlane'
As a (3D) geometric primitive, it obeys to a subset of the concept CSegmentComputer. It is copy constructible, assignable. It is iterable (inner type ConstIterator, begin(), end()). You may clear() it. It has methods extend(), extend( InputIterator, InputIterator) and isExtendable(), isExtendable(InputIterator, InputIterator). The object stores all the distinct points p
such that 'extend( p
)' was successful. It is thus a model of boost::ForwardContainer (non mutable).
It is also a model of CPointPredicate (returns 'true' iff a point is within the current bounds).
Note on complexity: See COBANaivePlane. Although it uses three instances of COBANaivePlane, the recognition is not three times slower. Indeed, recognition stops quickly on bad axes.
Note on execution times: The user should favor int64_t instead of BigInteger whenever possible (diameter smaller than 500). The speed-up is between 10 and 20 for these diameters. For greater diameters, it is necessary to use BigInteger (see below).
TSpace | specifies the type of digital space in which lies input digital points. A model of CSpace. |
TInternalInteger | specifies the type of integer used in internal computations. The type should be able to hold integers of order (2*D^3)^2 if D is the diameter of the set of digital points. In practice, diameter is limited to 20 for int32_t, diameter is approximately 500 for int64_t, and whatever with BigInteger/GMP integers. For huge diameters, the slow-down is polylogarithmic with the diameter. |
Essentially a backport from ImaGene.
Model of boost::DefaultConstructible, boost::CopyConstructible, boost::Assignable, boost::ForwardContainer, CPointPredicate.
Definition at line 121 of file COBAGenericNaivePlane.h.
|
private |
Definition at line 152 of file COBAGenericNaivePlane.h.
|
private |
Definition at line 151 of file COBAGenericNaivePlane.h.
|
private |
Definition at line 150 of file COBAGenericNaivePlane.h.
typedef PointSet::const_iterator DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::const_iterator |
Definition at line 141 of file COBAGenericNaivePlane.h.
typedef PointSet::const_pointer DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::const_pointer |
Definition at line 142 of file COBAGenericNaivePlane.h.
typedef PointSet::const_reference DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::const_reference |
Definition at line 143 of file COBAGenericNaivePlane.h.
typedef PointSet::const_iterator DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::ConstIterator |
Definition at line 134 of file COBAGenericNaivePlane.h.
typedef PointSet::difference_type DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::difference_type |
Definition at line 145 of file COBAGenericNaivePlane.h.
typedef TInternalInteger DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::InternalInteger |
Definition at line 136 of file COBAGenericNaivePlane.h.
typedef PointSet::iterator DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::Iterator |
Definition at line 135 of file COBAGenericNaivePlane.h.
typedef IntegerComputer< InternalInteger > DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::MyIntegerComputer |
Definition at line 137 of file COBAGenericNaivePlane.h.
typedef Space::Point DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::Point |
Definition at line 131 of file COBAGenericNaivePlane.h.
typedef std::set< Point > DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::PointSet |
Definition at line 132 of file COBAGenericNaivePlane.h.
typedef PointSet::size_type DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::Size |
Definition at line 133 of file COBAGenericNaivePlane.h.
typedef PointSet::size_type DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::size_type |
Definition at line 146 of file COBAGenericNaivePlane.h.
typedef TSpace DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::Space |
Definition at line 130 of file COBAGenericNaivePlane.h.
typedef PointSet::value_type DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::value_type |
Definition at line 144 of file COBAGenericNaivePlane.h.
|
inline |
|
inline |
Constructor. The object is not valid and should be initialized.
Definition at line 52 of file COBAGenericNaivePlane.ih.
|
inline |
Copy constructor.
other | the object to clone. |
Definition at line 60 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::_axesToErase, DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::myAxes, and DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::myComputers.
|
inline |
Definition at line 89 of file COBAGenericNaivePlane.ih.
ConstIterator DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::begin | ( | ) | const |
|
private |
|
private |
|
private |
|
inline |
Clear the object, free memory. The plane keeps its main axis, diameter and width, but contains no point.
Definition at line 108 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::clear().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::clear().
|
inline |
Definition at line 171 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::complexity().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::complexity().
|
inline |
Definition at line 144 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::empty().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::empty().
ConstIterator DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::end | ( | ) | const |
bool DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::extend | ( | const Point & | p | ) |
Adds the point p and checks if we have still a digital plane of specified width. The plane parameters may be updated so as to include the new point.
p | any 3D point (in the specified diameter). |
Definition at line 221 of file COBAGenericNaivePlane.ih.
bool DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::extend | ( | TInputIterator | it, |
TInputIterator | itE | ||
) |
Adds the range of points [it, itE) and checks if we have still a digital plane of specified width. The plane parameters may be updated so as to include all the new points. All points pointed by iterators should be in the diameter of this object.
TInputIterator | any model of InputIterator on Point. |
it | an iterator on the first element of the range of 3D points. |
itE | an iterator after the last element of the range of 3D points. |
Definition at line 266 of file COBAGenericNaivePlane.ih.
|
inline |
Adds the point p to this plane if it is within the current bounds. The plane parameters are not updated.
p | any 3D point (in the specified diameter). |
Definition at line 190 of file COBAGenericNaivePlane.ih.
|
inline |
If n is the unit normal to the current plane, then n.x >= min and n.x <= max are the two half-planes defining it.
min | the lower bound (corresponding to the unit vector). |
max | the upper bound (corresponding to the unit vector). |
Definition at line 339 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::getBounds().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::getBounds().
|
inline |
Vector3D | any type T such that T.operator[](int i) returns a reference to a double. i ranges in 0,1,2. |
(updates) | the current normal vector |
Definition at line 319 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::getNormal().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::getNormal().
|
inline |
Vector3D | any type T such that T.operator[](int i) returns a reference to a double. i ranges in 0,1,2. |
(updates) | the current unit normal vector |
Definition at line 330 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::getUnitNormal().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::getUnitNormal().
|
inline |
Definition at line 99 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::ic().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::ic().
|
inline |
All these parameters cannot be changed during the process. After this call, the object is in a consistent state and can accept new points for recognition. Calls clear so that the object is ready to be extended.
diameter | the diameter for the set of points (maximum distance between the given points) |
widthNumerator | the maximal axis-width (x,y,or z) for the plane is defined as the rational number widthNumerator / widthDenominator (default is 1/1, i.e. naive plane). |
widthDenominator | the maximal axis-width (x,y,or z) for the plane is defined as the rational number widthNumerator / widthDenominator (default is 1/1, i.e. naive plane). |
Definition at line 122 of file COBAGenericNaivePlane.ih.
bool DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::isExtendable | ( | const Point & | p | ) | const |
Checks if we have still a digital plane of specified width when adding point p. The object is left unchanged whatever the returned value. The invariant is 'this->isExtendable( p ) == true <=> this->extend( p ) == true'.
p | any 3D point (in the specified diameter). |
Definition at line 250 of file COBAGenericNaivePlane.ih.
bool DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::isExtendable | ( | TInputIterator | it, |
TInputIterator | itE | ||
) | const |
Checks if we have still a digital plane of specified width when adding the range of points [it, itE). The object is left unchanged whatever the returned value. All points pointed by iterators should be in the diameter of this object. The invariant is 'this->isExtendable( it, itE ) == true <=> this->extend( it, itE ) == true'.
TInputIterator | any model of InputIterator on Point. |
it | an iterator on the first element of the range of 3D points. |
itE | an iterator after the last element of the range of 3D points. |
Definition at line 298 of file COBAGenericNaivePlane.ih.
|
inline |
Checks the validity/consistency of the object.
Definition at line 392 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::isValid().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::isValid().
|
inline |
NB: std version.
Definition at line 153 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::max_size().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::max_size().
|
inline |
Definition at line 357 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::maximalPoint().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::maximalPoint().
|
inline |
same as max_size
Definition at line 162 of file COBAGenericNaivePlane.ih.
|
inline |
Definition at line 348 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::minimalPoint().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::minimalPoint().
|
inline |
Checks if the point p is in the current digital plane. Therefore, a COBAGenericNaivePlane is a model of CPointPredicate.
p | any 3D point. |
Definition at line 180 of file COBAGenericNaivePlane.ih.
|
inline |
Assignment.
other | the object to copy. |
Definition at line 73 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::myAxes, and DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::myComputers.
|
inline |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Definition at line 374 of file COBAGenericNaivePlane.ih.
|
inline |
Definition at line 135 of file COBAGenericNaivePlane.ih.
References DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::size().
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::size().
|
mutableprivate |
Useful when erasing axes.
Definition at line 412 of file COBAGenericNaivePlane.h.
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::COBAGenericNaivePlane().
|
private |
The list of active plane axes. Starts with {0,1,2}. At least one.
Definition at line 410 of file COBAGenericNaivePlane.h.
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::COBAGenericNaivePlane(), and DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::operator=().
|
private |
The three COBA plane computers.
Definition at line 411 of file COBAGenericNaivePlane.h.
Referenced by DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::COBAGenericNaivePlane(), and DGtal::COBAGenericNaivePlane< TSpace, TInternalInteger >::operator=().