DGtal  0.9.4beta
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::NGon2D< TSpace > Class Template Reference

#include <DGtal/shapes/parametric/NGon2D.h>

Inheritance diagram for DGtal::NGon2D< TSpace >:
[legend]
Collaboration diagram for DGtal::NGon2D< TSpace >:
[legend]

Public Types

typedef TSpace Space
 
typedef Space::Point Point
 
typedef Space::RealPoint RealPoint2D
 
typedef Space::RealVector RealVector2D
 
- Public Types inherited from DGtal::StarShaped2D< TSpace >
typedef TSpace Space
 
typedef Space::Point Point
 
typedef Space::RealPoint RealPoint
 

Public Member Functions

 ~NGon2D ()
 
 NGon2D (const double x0, const double y0, const double r, const unsigned int k, const double phi)
 
 NGon2D (const RealPoint2D &aPoint, const double r, const unsigned int k, const double phi)
 
 NGon2D (const Point &aPoint, const double r, const unsigned int k, const double phi)
 
RealPoint2D getLowerBound () const
 
RealPoint2D getUpperBound () const
 
RealPoint2D center () const
 
double parameter (const RealPoint2D &p) const
 
RealPoint2D x (const double t) const
 
RealVector2D xp (const double t) const
 
RealVector2D xpp (const double t) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
- Public Member Functions inherited from DGtal::StarShaped2D< TSpace >
 StarShaped2D ()
 
 ~StarShaped2D ()
 
virtual RealPoint interiorPoint () const
 
Orientation orientation (const RealPoint &p) const
 
RealPoint tangent (double t) const
 
RealPoint normal (double t) const
 
double curvature (double t) const
 
double arclength (double t1, double t2, unsigned int nb) const
 
RealPoint findIntersection (const RealPoint &inner, const RealPoint &outer, const double epsilon) const
 
RealPoint closestPointWithWitnesses (const RealPoint &p, const RealPoint &left, const RealPoint &right, const int step) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Protected Member Functions

 NGon2D ()
 

Private Member Functions

NGon2Doperator= (const NGon2D &other)
 

Private Attributes

RealPoint2D myCenter
 
double myRadius
 
unsigned int myK
 
double myPhi
 

Detailed Description

template<typename TSpace>
class DGtal::NGon2D< TSpace >

Aim: Model of the concept StarShaped represents any regular k-gon in the plane.

Description of template class 'NGon2D'

NB: A backport from ImaGene.

Definition at line 63 of file NGon2D.h.

Member Typedef Documentation

template<typename TSpace >
typedef Space::Point DGtal::NGon2D< TSpace >::Point

Definition at line 69 of file NGon2D.h.

template<typename TSpace >
typedef Space::RealPoint DGtal::NGon2D< TSpace >::RealPoint2D

Definition at line 70 of file NGon2D.h.

template<typename TSpace >
typedef Space::RealVector DGtal::NGon2D< TSpace >::RealVector2D

Definition at line 71 of file NGon2D.h.

template<typename TSpace >
typedef TSpace DGtal::NGon2D< TSpace >::Space

Definition at line 68 of file NGon2D.h.

Constructor & Destructor Documentation

template<typename TSpace >
DGtal::NGon2D< TSpace >::~NGon2D ( )

Destructor.

template<typename TSpace >
DGtal::NGon2D< TSpace >::NGon2D ( const double  x0,
const double  y0,
const double  r,
const unsigned int  k,
const double  phi 
)

Constructor.

Parameters
x0the x-coordinate of the circle center.
y0the y-coordinate of the circle center.
rthe radius of the circle.
kthe number of faces of the k-gon.
phithe phase of the ngon (radian).
template<typename TSpace >
DGtal::NGon2D< TSpace >::NGon2D ( const RealPoint2D aPoint,
const double  r,
const unsigned int  k,
const double  phi 
)

Constructor.

Parameters
aPointthe circle center.
rthe radius of the circle.
kthe number of faces of the k-gon.
phithe phase of the ngon (radian).
template<typename TSpace >
DGtal::NGon2D< TSpace >::NGon2D ( const Point aPoint,
const double  r,
const unsigned int  k,
const double  phi 
)

Constructor.

Parameters
aPointthe circle center.
rthe radius of the circle.
kthe number of faces of the k-gon.
phithe phase of the ngon (radian).
template<typename TSpace >
DGtal::NGon2D< TSpace >::NGon2D ( )
protected

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

Member Function Documentation

template<typename TSpace >
RealPoint2D DGtal::NGon2D< TSpace >::center ( ) const
inlinevirtual
Returns
the center of the star-shaped object.

Implements DGtal::StarShaped2D< TSpace >.

Definition at line 134 of file NGon2D.h.

References DGtal::NGon2D< TSpace >::myCenter.

135  {
136  return myCenter;
137  }
RealPoint2D myCenter
Definition: NGon2D.h:178
template<typename TSpace >
RealPoint2D DGtal::NGon2D< TSpace >::getLowerBound ( ) const
inlinevirtual
Returns
the lower bound of the shape bounding box.

Implements DGtal::StarShaped2D< TSpace >.

Definition at line 117 of file NGon2D.h.

References DGtal::NGon2D< TSpace >::myCenter, and DGtal::NGon2D< TSpace >::myRadius.

118  {
119  return RealPoint2D(myCenter[0] - myRadius, myCenter[1] - myRadius);
120  }
RealPoint2D myCenter
Definition: NGon2D.h:178
double myRadius
Definition: NGon2D.h:183
Space::RealPoint RealPoint2D
Definition: NGon2D.h:70
template<typename TSpace >
RealPoint2D DGtal::NGon2D< TSpace >::getUpperBound ( ) const
inlinevirtual
Returns
the upper bound of the shape bounding box.

Implements DGtal::StarShaped2D< TSpace >.

Definition at line 126 of file NGon2D.h.

References DGtal::NGon2D< TSpace >::myCenter, and DGtal::NGon2D< TSpace >::myRadius.

127  {
128  return RealPoint2D(myCenter[0] + myRadius, myCenter[1] + myRadius);
129  }
RealPoint2D myCenter
Definition: NGon2D.h:178
double myRadius
Definition: NGon2D.h:183
Space::RealPoint RealPoint2D
Definition: NGon2D.h:70
template<typename TSpace >
bool DGtal::NGon2D< TSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TSpace >
NGon2D& DGtal::NGon2D< TSpace >::operator= ( const NGon2D< TSpace > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default. Assignment.
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.
template<typename TSpace >
double DGtal::NGon2D< TSpace >::parameter ( const RealPoint2D p) const
virtual
Parameters
pany point in the plane.
Returns
the angle parameter between 0 and 2*Pi corresponding to this point for the shape.

Implements DGtal::StarShaped2D< TSpace >.

template<typename TSpace >
void DGtal::NGon2D< TSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TSpace >
RealPoint2D DGtal::NGon2D< TSpace >::x ( const double  t) const
virtual
Parameters
tany angle between 0 and 2*Pi.
Returns
the vector (x(t),y(t)) which is the position on the shape boundary.

Implements DGtal::StarShaped2D< TSpace >.

template<typename TSpace >
RealVector2D DGtal::NGon2D< TSpace >::xp ( const double  t) const
virtual
Parameters
tany angle between 0 and 2*Pi.
Returns
the vector (x'(t),y'(t)) which is the tangent to the shape boundary.

Implements DGtal::StarShaped2D< TSpace >.

template<typename TSpace >
RealVector2D DGtal::NGon2D< TSpace >::xpp ( const double  t) const
virtual
Parameters
tany angle between 0 and 2*Pi.
Returns
the vector (x''(t),y''(t)).

Implements DGtal::StarShaped2D< TSpace >.

Field Documentation

template<typename TSpace >
RealPoint2D DGtal::NGon2D< TSpace >::myCenter
private
template<typename TSpace >
unsigned int DGtal::NGon2D< TSpace >::myK
private

Number of sides of the ngon.

Definition at line 188 of file NGon2D.h.

template<typename TSpace >
double DGtal::NGon2D< TSpace >::myPhi
private

Phase of the ngon (radian).

Definition at line 193 of file NGon2D.h.

template<typename TSpace >
double DGtal::NGon2D< TSpace >::myRadius
private

Radius of the circle.

Definition at line 183 of file NGon2D.h.

Referenced by DGtal::NGon2D< TSpace >::getLowerBound(), and DGtal::NGon2D< TSpace >::getUpperBound().


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