DGtal
1.5.beta
|
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 COBANaivePlaneComputer, the axis is not specified at initialization of the object. This class uses three instances of COBANaivePlaneComputer, one per axis. More...
#include <DGtal/geometry/surfaces/COBAGenericNaivePlaneComputer.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 COBANaivePlaneComputer< Space, InternalInteger > | COBAComputer |
typedef COBAComputer::Primitive | Primitive |
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 | |
~COBAGenericNaivePlaneComputer () | |
COBAGenericNaivePlaneComputer () | |
COBAGenericNaivePlaneComputer (const COBAGenericNaivePlaneComputer &other) | |
COBAGenericNaivePlaneComputer & | operator= (const COBAGenericNaivePlaneComputer &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 |
Primitive | primitive () 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 std::vector< Dimension >::iterator | AxisIterator |
typedef std::vector< Dimension >::const_iterator | AxisConstIterator |
Private Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >)) | |
BOOST_CONCEPT_ASSERT ((concepts::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 COBANaivePlaneComputer, the axis is not specified at initialization of the object. This class uses three instances of COBANaivePlaneComputer, one per axis.
Description of template class 'COBAGenericNaivePlaneComputer'
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 concepts::CPointPredicate (returns 'true' iff a point is within the current bounds).
Note on complexity: See COBANaivePlaneComputer. Although it uses three instances of COBANaivePlaneComputer, 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, concepts::CAdditivePrimitiveComputer, concepts::CPointPredicate.
Definition at line 121 of file COBAGenericNaivePlaneComputer.h.
|
private |
Definition at line 153 of file COBAGenericNaivePlaneComputer.h.
|
private |
Definition at line 152 of file COBAGenericNaivePlaneComputer.h.
typedef COBANaivePlaneComputer< Space, InternalInteger > DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::COBAComputer |
Definition at line 138 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::const_iterator DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::const_iterator |
Definition at line 143 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::const_pointer DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::const_pointer |
Definition at line 144 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::const_reference DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::const_reference |
Definition at line 145 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::const_iterator DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::ConstIterator |
Definition at line 134 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::difference_type DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::difference_type |
Definition at line 147 of file COBAGenericNaivePlaneComputer.h.
typedef TInternalInteger DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::InternalInteger |
Definition at line 136 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::iterator DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::Iterator |
Definition at line 135 of file COBAGenericNaivePlaneComputer.h.
typedef IntegerComputer< InternalInteger > DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::MyIntegerComputer |
Definition at line 137 of file COBAGenericNaivePlaneComputer.h.
typedef Space::Point DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::Point |
Definition at line 131 of file COBAGenericNaivePlaneComputer.h.
typedef std::set< Point > DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::PointSet |
Definition at line 132 of file COBAGenericNaivePlaneComputer.h.
typedef COBAComputer::Primitive DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::Primitive |
Definition at line 139 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::size_type DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::Size |
Definition at line 133 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::size_type DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::size_type |
Definition at line 148 of file COBAGenericNaivePlaneComputer.h.
typedef TSpace DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::Space |
Definition at line 130 of file COBAGenericNaivePlaneComputer.h.
typedef PointSet::value_type DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::value_type |
Definition at line 146 of file COBAGenericNaivePlaneComputer.h.
DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::~COBAGenericNaivePlaneComputer | ( | ) |
Destructor.
DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::COBAGenericNaivePlaneComputer | ( | ) |
Constructor. The object is not valid and should be initialized.
DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::COBAGenericNaivePlaneComputer | ( | const COBAGenericNaivePlaneComputer< TSpace, TInternalInteger > & | other | ) |
Copy constructor.
other | the object to clone. |
Dimension DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::active | ( | ) | const |
ConstIterator DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::begin | ( | ) | const |
|
private |
|
private |
|
private |
void DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::clear | ( | ) |
Clear the object, free memory. The plane keeps its main axis, diameter and width, but contains no point.
Size DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::complexity | ( | ) | const |
bool DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::empty | ( | ) | const |
ConstIterator DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::end | ( | ) | const |
bool DGtal::COBAGenericNaivePlaneComputer< 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). |
bool DGtal::COBAGenericNaivePlaneComputer< 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. |
bool DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::extendAsIs | ( | const Point & | p | ) |
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). |
void DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::getBounds | ( | double & | min, |
double & | max | ||
) | const |
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). |
void DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::getNormal | ( | Vector3D & | normal | ) | const |
Vector3D | any type T such that T.operator[](int i) returns a reference to a double. i ranges in 0,1,2. |
[in,out] | normal | (updates) the current normal vector |
void DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::getUnitNormal | ( | Vector3D & | normal | ) | const |
Vector3D | any type T such that T.operator[](int i) returns a reference to a double. i ranges in 0,1,2. |
normal | (updates) the current unit normal vector |
MyIntegerComputer& DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::ic | ( | ) | const |
void DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::init | ( | InternalInteger | diameter, |
InternalInteger | widthNumerator = NumberTraits< InternalInteger >::ONE , |
||
InternalInteger | widthDenominator = NumberTraits< InternalInteger >::ONE |
||
) |
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). |
bool DGtal::COBAGenericNaivePlaneComputer< 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). |
bool DGtal::COBAGenericNaivePlaneComputer< 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. |
bool DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Size DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::max_size | ( | ) | const |
NB: std version.
const Point& DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::maximalPoint | ( | ) | const |
Size DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::maxSize | ( | ) | const |
same as max_size
const Point& DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::minimalPoint | ( | ) | const |
bool DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::operator() | ( | const Point & | p | ) | const |
Checks if the point p is in the current digital plane. Therefore, a COBAGenericNaivePlaneComputer is a model of concepts::CPointPredicate.
p | any 3D point. |
COBAGenericNaivePlaneComputer& DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::operator= | ( | const COBAGenericNaivePlaneComputer< TSpace, TInternalInteger > & | other | ) |
Assignment.
other | the object to copy. |
Primitive DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::primitive | ( | ) | const |
void DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Size DGtal::COBAGenericNaivePlaneComputer< TSpace, TInternalInteger >::size | ( | ) | const |
|
mutableprivate |
Useful when erasing axes.
Definition at line 428 of file COBAGenericNaivePlaneComputer.h.
|
private |
The list of active plane axes. Starts with {0,1,2}. At least one.
Definition at line 426 of file COBAGenericNaivePlaneComputer.h.
|
private |
The three COBA plane computers.
Definition at line 427 of file COBAGenericNaivePlaneComputer.h.