DGtal 1.4.0
|
Aim: A class that recognizes pieces of digital planes of given diagonal width. When the width is \(1 \times \sqrt{3}\), it corresponds to standard planes. Contrary to ChordStandardPlaneComputer, the axis is not specified at initialization of the object. This class uses four instances of ChordStandardPlaneComputer of axis z, by transforming points \((x,y,z)\) to \((x \pm z, y \pm z, z)\). More...
#include <DGtal/geometry/surfaces/ChordGenericStandardPlaneComputer.h>
Data Structures | |
struct | Transform |
Public Member Functions | |
~ChordGenericStandardPlaneComputer () | |
ChordGenericStandardPlaneComputer () | |
ChordGenericStandardPlaneComputer (const ChordGenericStandardPlaneComputer &other) | |
ChordGenericStandardPlaneComputer & | operator= (const ChordGenericStandardPlaneComputer &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 |
InputPoint | minimalPoint () const |
InputPoint | maximalPoint () const |
void | getCharacteristics (InternalVector &n, InternalScalar &imin, InternalScalar &imax, InputPoint &p_min, InputPoint &p_max) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Static Protected Member Functions | |
static Transform | t (Dimension orthant) |
static Transform | invT (Dimension orthant) |
Private Types | |
typedef std::vector< Dimension >::iterator | OrthantIterator |
typedef std::vector< Dimension >::const_iterator | OrthantConstIterator |
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 > | myOrthants |
ChordComputer | myComputers [4] |
std::vector< Dimension > | _orthantsToErase |
Static Private Attributes | |
static Transform | myTransforms [4] |
Aim: A class that recognizes pieces of digital planes of given diagonal width. When the width is \(1 \times \sqrt{3}\), it corresponds to standard planes. Contrary to ChordStandardPlaneComputer, the axis is not specified at initialization of the object. This class uses four instances of ChordStandardPlaneComputer of axis z, by transforming points \((x,y,z)\) to \((x \pm z, y \pm z, z)\).
Description of template class 'ChordGenericStandardPlaneComputer'
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 four instances of ChordStandardNaiveComputer, the recognition is not four times slower. Indeed, recognition stops quickly on bad diagonal 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 122 of file ChordGenericStandardPlaneComputer.h.
typedef ChordNaivePlaneComputer< Space, InputPoint, InternalScalar > DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::ChordComputer |
Definition at line 135 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::Component DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::Component |
Definition at line 136 of file ChordGenericStandardPlaneComputer.h.
typedef ConstIterator DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::const_iterator |
Definition at line 208 of file ChordGenericStandardPlaneComputer.h.
typedef const InputPoint* DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::const_pointer |
Definition at line 209 of file ChordGenericStandardPlaneComputer.h.
typedef const InputPoint& DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::const_reference |
Definition at line 210 of file ChordGenericStandardPlaneComputer.h.
typedef boost::transform_iterator<Transform,InputPointSetConstIterator, InputPoint,InputPoint> DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::ConstIterator |
We wrap a transform over the iterator on point that uses one of the functor Transform to cast back the point from the naive space to the standard space.
Definition at line 204 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::Coordinate DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::Coordinate |
Definition at line 137 of file ChordGenericStandardPlaneComputer.h.
typedef InputPointSet::difference_type DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::difference_type |
Definition at line 212 of file ChordGenericStandardPlaneComputer.h.
typedef TInputPoint DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputPoint |
Definition at line 132 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::InputPointSet DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputPointSet |
Definition at line 141 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::ConstIterator DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputPointSetConstIterator |
Definition at line 143 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::Iterator DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputPointSetIterator |
Definition at line 144 of file ChordGenericStandardPlaneComputer.h.
typedef InputPoint DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InputVector |
Definition at line 134 of file ChordGenericStandardPlaneComputer.h.
typedef TInternalScalar DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InternalScalar |
Definition at line 133 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::InternalVector DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::InternalVector |
Definition at line 138 of file ChordGenericStandardPlaneComputer.h.
|
private |
Definition at line 149 of file ChordGenericStandardPlaneComputer.h.
|
private |
Definition at line 148 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::Point DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::Point |
Definition at line 139 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::Primitive DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::Primitive |
Definition at line 140 of file ChordGenericStandardPlaneComputer.h.
typedef ChordComputer::Size DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::Size |
Definition at line 142 of file ChordGenericStandardPlaneComputer.h.
typedef InputPointSet::size_type DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::size_type |
Definition at line 213 of file ChordGenericStandardPlaneComputer.h.
typedef TSpace DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::Space |
Definition at line 131 of file ChordGenericStandardPlaneComputer.h.
typedef InputPoint DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::value_type |
Definition at line 211 of file ChordGenericStandardPlaneComputer.h.
DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::~ChordGenericStandardPlaneComputer | ( | ) |
Destructor.
DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::ChordGenericStandardPlaneComputer | ( | ) |
Constructor. The object is not valid and should be initialized.
DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::ChordGenericStandardPlaneComputer | ( | const ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar > & | other | ) |
Copy constructor.
other | the object to clone. |
Dimension DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::active | ( | ) | const |
ConstIterator DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::begin | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
void DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::clear | ( | ) |
Clear the object, free memory. The plane keeps its main axis, diameter and width, but contains no point.
bool DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::empty | ( | ) | const |
ConstIterator DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::end | ( | ) | const |
bool DGtal::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::getCharacteristics | ( | InternalVector & | n, |
InternalScalar & | imin, | ||
InternalScalar & | imax, | ||
InputPoint & | p_min, | ||
InputPoint & | p_max ) const |
The basic method for computing all characteristics of the recognized plane. Used by primitive, minimalPoint, maximalPoint, getBounds.
[out] | n | the integral normal vector (with last component positive). |
[out] | imin | the minimum dot product of an inserted point with n. |
[out] | imax | the maximum dot product of an inserted point with n. |
[out] | p_min | an inserted point satisfying the minimum dot product imin. |
[out] | p_max | an inserted point satisfying the maximum dot product imax. |
void DGtal::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< 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 diagonal width for the plane is defined as the rational number widthNumerator / widthDenominator x sqrt(3). (default is 1/1 x sqrt(3), i.e. standard plane). |
widthDenominator | the maximal diagonal width for the plane is defined as the rational number widthNumerator / widthDenominator x sqrt(3). (default is 1/1 x sqrt(3), i.e. standard plane). |
|
staticprotected |
orthant | any orthant specified as an integer between 0 and 3. |
bool DGtal::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Size DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::max_size | ( | ) | const |
NB: std version.
InputPoint DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::maximalPoint | ( | ) | const |
Size DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::maxSize | ( | ) | const |
same as max_size
InputPoint DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::minimalPoint | ( | ) | const |
bool DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::operator() | ( | const Point & | p | ) | const |
Checks if the point p is in the current digital plane. Therefore, a ChordGenericStandardPlaneComputer is a model of concepts::CPointPredicate.
p | any 3D point. |
ChordGenericStandardPlaneComputer & DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::operator= | ( | const ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar > & | other | ) |
Assignment.
other | the object to copy. |
Primitive DGtal::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::primitive | ( | ) | const |
void DGtal::ChordGenericStandardPlaneComputer< 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::ChordGenericStandardPlaneComputer< TSpace, TInputPoint, TInternalScalar >::size | ( | ) | const |
|
staticprotected |
orthant | any orthant specified as an integer between 0 and 3. |
|
mutableprivate |
Useful when erasing orthants.
Definition at line 493 of file ChordGenericStandardPlaneComputer.h.
|
private |
The four Chord plane computers.
Definition at line 491 of file ChordGenericStandardPlaneComputer.h.
|
private |
The list of active plane orthants. Starts with {0:++,1:+-,2:-+,3:–}.
Definition at line 490 of file ChordGenericStandardPlaneComputer.h.
|
staticprivate |
The four space transformation associated with each Chord plane computer, shared by all computers.
Definition at line 492 of file ChordGenericStandardPlaneComputer.h.