DGtal 1.3.0
|
Aim: A class that recognizes pieces of digital planes of given axis width. When the diagonal width is \( 1 \times \sqrt{3} \), it corresponds to standard planes. Contrary to COBANaivePlaneComputer, the axis is not specified at initialization of the object. This class uses four instances of COBANaivePlaneComputer of axis z, by transforming points \((x,y,z)\) to \((x \pm z, y \pm z, z)\). More...
#include <DGtal/geometry/surfaces/COBAGenericStandardPlaneComputer.h>
Data Structures | |
struct | Transform |
Public Types | |
typedef TSpace | Space |
typedef Space::Point | Point |
typedef std::set< Point > | PointSet |
typedef PointSet::size_type | Size |
typedef PointSet::const_iterator | PointSetConstIterator |
typedef PointSet::iterator | PointSetIterator |
typedef TInternalInteger | InternalInteger |
typedef IntegerComputer< InternalInteger > | MyIntegerComputer |
typedef COBANaivePlaneComputer< Space, InternalInteger > | COBAComputer |
typedef COBAComputer::Primitive | Primitive |
typedef COBAComputer::IntegerVector3 | IntegerVector3 |
typedef boost::transform_iterator< Transform, PointSetConstIterator, Point, Point > | ConstIterator |
typedef ConstIterator | const_iterator |
typedef const Point * | const_pointer |
typedef const Point & | const_reference |
typedef Point | value_type |
typedef PointSet::difference_type | difference_type |
typedef PointSet::size_type | size_type |
Public Member Functions | |
~COBAGenericStandardPlaneComputer () | |
COBAGenericStandardPlaneComputer () | |
COBAGenericStandardPlaneComputer (const COBAGenericStandardPlaneComputer &other) | |
COBAGenericStandardPlaneComputer & | operator= (const COBAGenericStandardPlaneComputer &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 |
Point | minimalPoint () const |
Point | maximalPoint () const |
void | getCharacteristics (IntegerVector3 &n, InternalInteger &imin, InternalInteger &imax, Point &p_min, Point &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::CInteger< TInternalInteger >)) | |
BOOST_STATIC_ASSERT ((TSpace::dimension==3)) | |
Private Attributes | |
std::vector< Dimension > | myOrthants |
COBAComputer | myComputers [4] |
std::vector< Dimension > | _orthantsToErase |
Static Private Attributes | |
static Transform | myTransforms [4] |
Aim: A class that recognizes pieces of digital planes of given axis width. When the diagonal width is \( 1 \times \sqrt{3} \), it corresponds to standard planes. Contrary to COBANaivePlaneComputer, the axis is not specified at initialization of the object. This class uses four instances of COBANaivePlaneComputer of axis z, by transforming points \((x,y,z)\) to \((x \pm z, y \pm z, z)\).
Description of template class 'COBAGenericStandardPlaneComputer'
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 COBAStandardPlaneComputer. Although it uses four instances of COBAStandardPlaneComputer, the recognition is not four times slower. Indeed, recognition stops quickly on bad orthants.
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. |
Model of boost::DefaultConstructible, boost::CopyConstructible, boost::Assignable, boost::ForwardContainer, concepts::CAdditivePrimitiveComputer, concepts::CPointPredicate.
Definition at line 128 of file COBAGenericStandardPlaneComputer.h.
typedef COBANaivePlaneComputer< Space, InternalInteger > DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::COBAComputer |
Definition at line 145 of file COBAGenericStandardPlaneComputer.h.
typedef ConstIterator DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::const_iterator |
Definition at line 224 of file COBAGenericStandardPlaneComputer.h.
typedef const Point* DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::const_pointer |
Definition at line 225 of file COBAGenericStandardPlaneComputer.h.
typedef const Point& DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::const_reference |
Definition at line 226 of file COBAGenericStandardPlaneComputer.h.
typedef boost::transform_iterator<Transform,PointSetConstIterator,Point,Point> DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::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 220 of file COBAGenericStandardPlaneComputer.h.
typedef PointSet::difference_type DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::difference_type |
Definition at line 228 of file COBAGenericStandardPlaneComputer.h.
typedef COBAComputer::IntegerVector3 DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::IntegerVector3 |
Definition at line 147 of file COBAGenericStandardPlaneComputer.h.
typedef TInternalInteger DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::InternalInteger |
Definition at line 143 of file COBAGenericStandardPlaneComputer.h.
typedef IntegerComputer< InternalInteger > DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::MyIntegerComputer |
Definition at line 144 of file COBAGenericStandardPlaneComputer.h.
|
private |
Definition at line 152 of file COBAGenericStandardPlaneComputer.h.
|
private |
Definition at line 151 of file COBAGenericStandardPlaneComputer.h.
typedef Space::Point DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::Point |
Definition at line 138 of file COBAGenericStandardPlaneComputer.h.
typedef std::set< Point > DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::PointSet |
Definition at line 139 of file COBAGenericStandardPlaneComputer.h.
typedef PointSet::const_iterator DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::PointSetConstIterator |
Definition at line 141 of file COBAGenericStandardPlaneComputer.h.
typedef PointSet::iterator DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::PointSetIterator |
Definition at line 142 of file COBAGenericStandardPlaneComputer.h.
typedef COBAComputer::Primitive DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::Primitive |
Definition at line 146 of file COBAGenericStandardPlaneComputer.h.
typedef PointSet::size_type DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::Size |
Definition at line 140 of file COBAGenericStandardPlaneComputer.h.
typedef PointSet::size_type DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::size_type |
Definition at line 229 of file COBAGenericStandardPlaneComputer.h.
typedef TSpace DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::Space |
Definition at line 137 of file COBAGenericStandardPlaneComputer.h.
typedef Point DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::value_type |
Definition at line 227 of file COBAGenericStandardPlaneComputer.h.
DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::~COBAGenericStandardPlaneComputer | ( | ) |
Destructor.
DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::COBAGenericStandardPlaneComputer | ( | ) |
Constructor. The object is not valid and should be initialized.
DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::COBAGenericStandardPlaneComputer | ( | const COBAGenericStandardPlaneComputer< TSpace, TInternalInteger > & | other | ) |
Copy constructor.
other | the object to clone. |
Dimension DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::active | ( | ) | const |
ConstIterator DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::begin | ( | ) | const |
|
private |
|
private |
|
private |
void DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::clear | ( | ) |
Clear the object, free memory. The plane keeps its main axis, diameter and width, but contains no point.
Size DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::complexity | ( | ) | const |
bool DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::empty | ( | ) | const |
ConstIterator DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::end | ( | ) | const |
bool DGtal::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::getCharacteristics | ( | IntegerVector3 & | n, |
InternalInteger & | imin, | ||
InternalInteger & | imax, | ||
Point & | p_min, | ||
Point & | 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::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::ic | ( | ) | const |
void DGtal::COBAGenericStandardPlaneComputer< 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 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). |
Referenced by main().
|
staticprotected |
orthant | any orthant specified as an integer between 0 and 3. |
bool DGtal::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Size DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::max_size | ( | ) | const |
NB: std version.
Point DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::maximalPoint | ( | ) | const |
Size DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::maxSize | ( | ) | const |
same as max_size
Point DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::minimalPoint | ( | ) | const |
bool DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::operator() | ( | const Point & | p | ) | const |
Checks if the point p is in the current digital plane. Therefore, a COBAGenericStandardPlaneComputer is a model of concepts::CPointPredicate.
p | any 3D point. |
COBAGenericStandardPlaneComputer & DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::operator= | ( | const COBAGenericStandardPlaneComputer< TSpace, TInternalInteger > & | other | ) |
Assignment.
other | the object to copy. |
Primitive DGtal::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::primitive | ( | ) | const |
void DGtal::COBAGenericStandardPlaneComputer< 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::COBAGenericStandardPlaneComputer< TSpace, TInternalInteger >::size | ( | ) | const |
|
staticprotected |
orthant | any orthant specified as an integer between 0 and 3. |
|
mutableprivate |
Useful when erasing orthants.
Definition at line 523 of file COBAGenericStandardPlaneComputer.h.
|
private |
The four COBA plane computers.
Definition at line 521 of file COBAGenericStandardPlaneComputer.h.
|
private |
The list of active plane orthants. Starts with {0:++,1:+-,2:-+,3:–}.
Definition at line 520 of file COBAGenericStandardPlaneComputer.h.
|
staticprivate |
The four space transformation associated with each COBA plane computer, shared by all computers.
Definition at line 522 of file COBAGenericStandardPlaneComputer.h.