DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions
DGtal::ContourHelper Class Reference

#include <ContourHelper.h>

Public Member Functions

 ~ContourHelper ()
void selfDisplay (std::ostream &out) const
bool isValid () const

Static Public Member Functions

static Z2i::Point getMeanPoint (vector< Z2i::Point > contour)

Protected Member Functions

 ContourHelper ()

Private Member Functions

 ContourHelper (const ContourHelper &other)
ContourHelperoperator= (const ContourHelper &other)

Detailed Description

Aim: a helper class to process sequences of points.

Description of class 'ContourHelper'

Todo:
Improve class.

Definition at line 59 of file ContourHelper.h.


Constructor & Destructor Documentation

DGtal::ContourHelper::~ContourHelper ( )

Destructor.

DGtal::ContourHelper::ContourHelper ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

DGtal::ContourHelper::ContourHelper ( const ContourHelper other)
private

Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default.

Member Function Documentation

Z2i::Point ContourHelper::getMeanPoint ( vector< Z2i::Point contour)
inlinestatic

Compute the barycenter of the 2D contour.

Parameters:
contour,:the vector containing the 2D contour coordinates

Definition at line 46 of file ContourHelper.ih.

References DGtal::PointVector< dim, TEuclideanRing >::at(), and DGtal::PointVector< dim, TEuclideanRing >::size().

{
Z2i::Point ptMean;
for(unsigned int i =0; i<contour.size(); i++){
ptMean[0]+=contour.at(i)[0];
ptMean[1]+=contour.at(i)[1];
}
ptMean[0] /= (int)contour.size();
ptMean[1] /= (int)contour.size();
return ptMean;
}
bool DGtal::ContourHelper::isValid ( ) const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
ContourHelper& DGtal::ContourHelper::operator= ( const ContourHelper other)
private

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.
void DGtal::ContourHelper::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

The documentation for this class was generated from the following files: