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 ChordNaivePlaneComputer, the axis is not specified at initialization of the object. This class uses three instances of ChordNaivePlaneComputer, one per axis. More...
#include <DGtal/geometry/surfaces/ChordGenericNaivePlaneComputer.h>
Public Types | |
typedef TSpace | Space |
typedef TInputPoint | InputPoint |
typedef TInternalScalar | InternalScalar |
typedef InputPoint | InputVector |
typedef InputVector::Component | Component |
typedef InputPoint::Coordinate | Coordinate |
typedef InternalScalar | InternalVector[3] |
typedef Space::Point | Point |
typedef ChordNaivePlaneComputer< Space, InputPoint, InternalScalar > | ChordComputer |
typedef ChordComputer::Primitive | Primitive |
typedef std::set< InputPoint > | InputPointSet |
typedef InputPointSet::size_type | Size |
typedef InputPointSet::const_iterator | ConstIterator |
typedef InputPointSet::iterator | Iterator |
typedef InputPointSet::const_iterator | const_iterator |
typedef InputPointSet::const_pointer | const_pointer |
typedef InputPointSet::const_reference | const_reference |
typedef InputPointSet::value_type | value_type |
typedef InputPointSet::difference_type | difference_type |
typedef InputPointSet::size_type | size_type |
Public Member Functions | |
~ChordGenericNaivePlaneComputer () | |
ChordGenericNaivePlaneComputer () | |
ChordGenericNaivePlaneComputer (const ChordGenericNaivePlaneComputer &other) | |
ChordGenericNaivePlaneComputer & | operator= (const ChordGenericNaivePlaneComputer &other) |
Dimension | active () const |
void | clear () |
void | init (InternalScalar widthNumerator=NumberTraits< InternalScalar >::ONE, InternalScalar widthDenominator=NumberTraits< InternalScalar >::ONE) |
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 InputPoint &p) |
bool | extend (const InputPoint &p) |
bool | isExtendable (const InputPoint &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 InputPoint & | minimalPoint () const |
const InputPoint & | 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::CSignedNumber< TInternalScalar >)) | |
BOOST_STATIC_ASSERT ((TSpace::dimension==3)) | |
BOOST_STATIC_ASSERT ((TInputPoint::dimension==3)) | |
Private Attributes | |
std::vector< Dimension > | myAxes |
ChordComputer | 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 ChordNaivePlaneComputer, the axis is not specified at initialization of the object. This class uses three instances of ChordNaivePlaneComputer, one per axis.
Description of template class 'ChordGenericNaivePlaneComputer'
As a (3D) geometric primitive computer, it obeys the concept CAdditivePrimitiveComputer. It is copy constructible, assignable. 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 iterable (inner type ConstIterator, begin(), end()). You may clear() it.
It is also a model of concepts::CPointPredicate (returns 'true' iff a point is within the current bounds).
Note on complexity: See ChordNaivePlaneComputer and Comparative evaluation of COBA and Chord algorithm. Although it uses three instances of ChordNaivePlaneComputer, the recognition is not three times slower. Indeed, recognition stops quickly on bad axes.
TSpace | specifies the digital space (provides dimension and types for the primitive) |
TInputPoint | specifies the type of the input points (digital or not). Usually, you may choose TInputPoint = TSpace::Point, but this is not compulsory. You may for instance wish to manipulate floating-point value points. This is possible, but you have to choose the type TInternalScalar accordingly. |
TInternalScalar | specifies the type of scalar used in internal computations, generally a more precise type than TInputPoint::Component. For instance, for digital points, the type should be able to hold integers of order \((2*D)^2\) if D is the diameter of the set of digital points. |
Model of boost::DefaultConstructible, boost::CopyConstructible, boost::Assignable, boost::ForwardContainer, concepts::CAdditivePrimitiveComputer, concepts::CPointPredicate.
Definition at line 118 of file ChordGenericNaivePlaneComputer.h.
|
private |
Definition at line 155 of file ChordGenericNaivePlaneComputer.h.
|
private |
Definition at line 154 of file ChordGenericNaivePlaneComputer.h.
typedef ChordNaivePlaneComputer< Space, InputPoint, InternalScalar > DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::ChordComputer |
Definition at line 135 of file ChordGenericNaivePlaneComputer.h.
typedef InputVector::Component DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Component |
Definition at line 131 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::const_iterator DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::const_iterator |
Definition at line 145 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::const_pointer DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::const_pointer |
Definition at line 146 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::const_reference DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::const_reference |
Definition at line 147 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::const_iterator DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::ConstIterator |
Definition at line 140 of file ChordGenericNaivePlaneComputer.h.
typedef InputPoint::Coordinate DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Coordinate |
Definition at line 132 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::difference_type DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::difference_type |
Definition at line 149 of file ChordGenericNaivePlaneComputer.h.
typedef TInputPoint DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputPoint |
Definition at line 128 of file ChordGenericNaivePlaneComputer.h.
typedef std::set< InputPoint > DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputPointSet |
Definition at line 138 of file ChordGenericNaivePlaneComputer.h.
typedef InputPoint DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputVector |
Definition at line 130 of file ChordGenericNaivePlaneComputer.h.
typedef TInternalScalar DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::InternalScalar |
Definition at line 129 of file ChordGenericNaivePlaneComputer.h.
typedef InternalScalar DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::InternalVector[3] |
Definition at line 133 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::iterator DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Iterator |
Definition at line 141 of file ChordGenericNaivePlaneComputer.h.
typedef Space::Point DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Point |
Definition at line 134 of file ChordGenericNaivePlaneComputer.h.
typedef ChordComputer::Primitive DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Primitive |
Definition at line 136 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::size_type DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Size |
Definition at line 139 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::size_type DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::size_type |
Definition at line 150 of file ChordGenericNaivePlaneComputer.h.
typedef TSpace DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::Space |
Definition at line 127 of file ChordGenericNaivePlaneComputer.h.
typedef InputPointSet::value_type DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::value_type |
Definition at line 148 of file ChordGenericNaivePlaneComputer.h.
DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::~ChordGenericNaivePlaneComputer | ( | ) |
Destructor.
DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::ChordGenericNaivePlaneComputer | ( | ) |
Constructor. The object is not valid and should be initialized.
DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::ChordGenericNaivePlaneComputer | ( | const ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar > & | other | ) |
Copy constructor.
other | the object to clone. |
Dimension DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::active | ( | ) | const |
ConstIterator DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::begin | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
void DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::clear | ( | ) |
Clear the object, free memory. The plane keeps its main axis, diameter and width, but contains no point.
bool DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::empty | ( | ) | const |
ConstIterator DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::end | ( | ) | const |
bool DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::extend | ( | const InputPoint & | 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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::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 InputPoint. |
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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::extendAsIs | ( | const InputPoint & | 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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::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. |
normal | (updates) the current normal vector |
void DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::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 |
void DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::init | ( | InternalScalar | widthNumerator = NumberTraits< InternalScalar >::ONE , |
InternalScalar | widthDenominator = NumberTraits< InternalScalar >::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.
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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::isExtendable | ( | const InputPoint & | 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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::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 InputPoint. |
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::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Size DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::max_size | ( | ) | const |
NB: std version.
const InputPoint& DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::maximalPoint | ( | ) | const |
Size DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::maxSize | ( | ) | const |
same as max_size
const InputPoint& DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::minimalPoint | ( | ) | const |
bool DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::operator() | ( | const Point & | p | ) | const |
Checks if the point p is in the current digital plane. Therefore, a ChordGenericNaivePlaneComputer is a model of concepts::CPointPredicate.
p | any 3D point. |
ChordGenericNaivePlaneComputer& DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::operator= | ( | const ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar > & | other | ) |
Assignment.
other | the object to copy. |
Primitive DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::primitive | ( | ) | const |
void DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Size DGtal::ChordGenericNaivePlaneComputer< TSpace, TInputPoint, TInternalScalar >::size | ( | ) | const |
|
mutableprivate |
Useful when erasing axes.
Definition at line 416 of file ChordGenericNaivePlaneComputer.h.
|
private |
The list of active plane axes. Starts with {0,1,2}. At least one.
Definition at line 414 of file ChordGenericNaivePlaneComputer.h.
|
private |
The three COBA plane computers.
Definition at line 415 of file ChordGenericNaivePlaneComputer.h.