RobWorkProject  23.9.11-
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Contour2D Class Reference

class representing a 2d contour More...

#include <Contour2D.hpp>

Classes

class  Point
 the point description of the contour More...
 

Public Types

typedef rw::core::Ptr< Contour2DPtr
 smart pointer type to this class
 

Public Member Functions

 Contour2D ()
 constructor
 
 Contour2D (const rw::math::Vector2D<> &center, const std::vector< Point > &contour)
 constructor More...
 
size_t size () const
 get nr of conout points on this contour More...
 
Pointoperator[] (size_t i)
 get i'th contour point More...
 
const Pointoperator[] (size_t i) const
 get i'th contour point More...
 
double calcArea ()
 calculates the area of this contour
 
rw::math::Vector2Dcenter ()
 get contour center
 
const rw::math::Vector2Dcenter () const
 get contour center
 
std::vector< Point > & points ()
 get contour point list
 
const std::vector< Point > & points () const
 get contour point list
 
TriMesh::Ptr toTriMesh (double height)
 

Static Public Member Functions

static void write (Contour2D &objC, std::string file)
 writes a contour to file More...
 
static Contour2D read (std::string file)
 reads a contour from file More...
 
static double calcSequenceMoment (const Contour2D &contour, const rw::math::Vector2D<> &c, const int r)
 calculates the r'th sequence moment of an ordered contour More...
 
static double calcCentralMoments (const Contour2D &contour, const rw::math::Vector2D<> &c, const int r)
 calculates the r'th central moments of the contour More...
 
static Covariance calcCovarianceMatrix (const Contour2D &contour, const rw::math::Vector2D<> &c)
 Calculates the covariance of the contour "contour" with mean coordinate c. More...
 
static rw::math::Rotation2D calcOrientation (const Contour2D &contour, const rw::math::Vector2D<> &c)
 calculates the orientation of a contour where the first axis is the longest principal axis posible.
 
static rw::math::Vector2D calcCentroid (const Contour2D &contour)
 calculates the centroid or the mean of the points in the contour.
 
static double getCurvature (int idx, int pixelStep, const Contour2D &contour)
 extracts the local curvature around the contour point defined by idx.
 
static rw::math::Vector2D< double > calcNormal (int idx, int pixelStep, const Contour2D &contour, bool counterClock=true)
 calculate normals of a contour More...
 
static void recalcNormal (Contour2D &contour)
 recalculate normals of a contour More...
 
static Contour2D::Ptr getOuterContour (const Contour2D &contour, double resolution)
 extracts the outer contour of a contour More...
 

Detailed Description

class representing a 2d contour

Constructor & Destructor Documentation

◆ Contour2D()

Contour2D ( const rw::math::Vector2D<> &  center,
const std::vector< Point > &  contour 
)
inline

constructor

Parameters
center
contour

Member Function Documentation

◆ calcCentralMoments()

static double calcCentralMoments ( const Contour2D contour,
const rw::math::Vector2D<> &  c,
const int  r 
)
static

calculates the r'th central moments of the contour

Parameters
contour
c[in] center
r[in]
Returns
the moment

◆ calcCovarianceMatrix()

static Covariance calcCovarianceMatrix ( const Contour2D contour,
const rw::math::Vector2D<> &  c 
)
static

Calculates the covariance of the contour "contour" with mean coordinate c.

Parameters
contour[in] the contour
c[in] the mean of the contour points/coordinates
Returns
the 2x2 covariance matrix of the contour

◆ calcNormal()

static rw::math::Vector2D<double> calcNormal ( int  idx,
int  pixelStep,
const Contour2D contour,
bool  counterClock = true 
)
static

calculate normals of a contour

Parameters
idx
pixelStep
contour
counterClock
Returns
contour normal

◆ calcSequenceMoment()

static double calcSequenceMoment ( const Contour2D contour,
const rw::math::Vector2D<> &  c,
const int  r 
)
static

calculates the r'th sequence moment of an ordered contour

Parameters
contour[in]
c[in] center
r[in]

◆ getOuterContour()

static Contour2D::Ptr getOuterContour ( const Contour2D contour,
double  resolution 
)
static

extracts the outer contour of a contour

Parameters
contour[in] contour to find outer contour of.
resolution[in] the resolution.
Returns
new contour

◆ operator[]() [1/2]

Point& operator[] ( size_t  i)
inline

get i'th contour point

Parameters
i
Returns
the i'th contour point

◆ operator[]() [2/2]

const Point& operator[] ( size_t  i) const
inline

get i'th contour point

Parameters
i
Returns
the i'th contour point

◆ read()

static Contour2D read ( std::string  file)
static

reads a contour from file

Parameters
file
Returns
a contour

◆ recalcNormal()

static void recalcNormal ( Contour2D contour)
static

recalculate normals of a contour

Parameters
contour

◆ size()

size_t size ( ) const
inline

get nr of conout points on this contour

Returns
number of points

◆ toTriMesh()

TriMesh::Ptr toTriMesh ( double  height)

A 3D geometry for a 2D contour of height height.

2D points (x,y) end up as (x, y, 0) in 3D.

◆ write()

static void write ( Contour2D objC,
std::string  file 
)
static

writes a contour to file

Parameters
objC[in] contour to write to file
file[in] name of file

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