DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DGtal::AccFlower2D< TSpace > Class Template Reference

#include <AccFlower2D.h>

Inheritance diagram for DGtal::AccFlower2D< TSpace >:
Inheritance graph
[legend]
Collaboration diagram for DGtal::AccFlower2D< TSpace >:
Collaboration graph
[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 Space::RealPoint RealPoint

Public Member Functions

 ~AccFlower2D ()
 AccFlower2D (const double x0, const double y0, const double r, const double smallr, const unsigned int k, const double phi)
 AccFlower2D (const RealPoint2D &aPoint, const double r, const double smallr, const unsigned int k, const double phi)
 AccFlower2D (const Point &aPoint, const double r, const double smallr, 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
bool isInside (const RealPoint &p) const
bool isInside (const Point &p) 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

Protected Member Functions

 AccFlower2D ()

Private Member Functions

AccFlower2Doperator= (const AccFlower2D &other)

Private Attributes

RealPoint2D myCenter
double myRadius
double myVarRadius
unsigned int myK
double myKp
double myPhi

Detailed Description

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

Aim: Model of the concept StarShaped represents any accelerated flower in the plane.

Description of template class 'AccFlower2D'

NB: A backport from ImaGene.

Definition at line 64 of file AccFlower2D.h.


Member Typedef Documentation

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

Reimplemented from DGtal::StarShaped2D< TSpace >.

Definition at line 70 of file AccFlower2D.h.

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

Definition at line 71 of file AccFlower2D.h.

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

Definition at line 72 of file AccFlower2D.h.

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

Reimplemented from DGtal::StarShaped2D< TSpace >.

Definition at line 69 of file AccFlower2D.h.


Constructor & Destructor Documentation

template<typename T >
DGtal::AccFlower2D< T >::~AccFlower2D ( )
inline

Destructor.

Definition at line 48 of file AccFlower2D.ih.

{
}
template<typename T >
DGtal::AccFlower2D< T >::AccFlower2D ( const double  x0,
const double  y0,
const double  r,
const double  smallr,
const unsigned int  k,
const double  phi 
)
inline

Constructor.

Parameters:
x0the x-coordinate of the flower center.
y0the y-coordinate of the flower center.
rthe radius of the flower.
smallrthe variable small radius of the flower.
kthe number of flower extremeties.
phithe phase of the flower (in radian).

Definition at line 54 of file AccFlower2D.ih.

References M_PI, DGtal::AccFlower2D< TSpace >::myK, and DGtal::AccFlower2D< TSpace >::myKp.

: myCenter(x0,y0), myRadius(radius), myVarRadius(smallRadius),
myK(k), myPhi(phi)
{
myKp = 2 * myK/ ( M_PI * M_PI );
}
template<typename T >
DGtal::AccFlower2D< T >::AccFlower2D ( const RealPoint2D aPoint,
const double  r,
const double  smallr,
const unsigned int  k,
const double  phi 
)
inline

Constructor.

Parameters:
aPointthe flower center.
rthe radius of the flower.
smallrthe variable small radius of the flower.
kthe number of flower extremeties.
phithe phase of the flower (in radian).

Definition at line 66 of file AccFlower2D.ih.

References M_PI, DGtal::AccFlower2D< TSpace >::myK, and DGtal::AccFlower2D< TSpace >::myKp.

: myCenter(aPoint), myRadius(radius), myVarRadius(smallRadius),
myK(k), myPhi(phi)
{
myKp = 2 * myK/ ( M_PI * M_PI );
}
template<typename T >
DGtal::AccFlower2D< T >::AccFlower2D ( const Point aPoint,
const double  r,
const double  smallr,
const unsigned int  k,
const double  phi 
)
inline

Constructor.

Parameters:
aPointthe flower center.
rthe radius of the flower.
smallrthe variable small radius of the flower.
kthe number of flower extremeties.
phithe phase of the flower (in radian).

Definition at line 77 of file AccFlower2D.ih.

References M_PI, DGtal::AccFlower2D< TSpace >::myCenter, DGtal::AccFlower2D< TSpace >::myK, and DGtal::AccFlower2D< TSpace >::myKp.

: myRadius(radius), myVarRadius(smallRadius), myK(k), myPhi(phi)
{
myCenter = aPoint;
myKp = 2 * myK/ ( M_PI * M_PI );
}
template<typename TSpace>
DGtal::AccFlower2D< TSpace >::AccFlower2D ( )
protected

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


Member Function Documentation

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

Implements DGtal::StarShaped2D< TSpace >.

Definition at line 149 of file AccFlower2D.h.

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

{
return myCenter;
}
template<typename TSpace>
RealPoint2D DGtal::AccFlower2D< TSpace >::getLowerBound ( ) const
inlinevirtual
template<typename TSpace>
RealPoint2D DGtal::AccFlower2D< TSpace >::getUpperBound ( ) const
inlinevirtual
template<typename T >
bool DGtal::AccFlower2D< T >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Reimplemented from DGtal::StarShaped2D< TSpace >.

Definition at line 225 of file AccFlower2D.ih.

{
return true;
}
template<typename TSpace>
AccFlower2D& DGtal::AccFlower2D< TSpace >::operator= ( const AccFlower2D< 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 T >
double DGtal::AccFlower2D< T >::parameter ( const RealPoint2D pp) const
inlinevirtual
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 >.

Definition at line 98 of file AccFlower2D.ih.

References M_PI.

{
RealPoint2D p( pp );
p -= myCenter;
double angle = 0.0;
if ( ( p.at( 0 ) == 0.0 ) && ( p.at( 1 ) == 0.0 ) )
return angle;
if ( p.at( 0 ) >= p.at( 1 ) )
{
if ( p.at( 0 ) >= -p.at( 1 ) )
angle = atan( p.at( 1 ) / p.at( 0 ) );
else
angle = 1.5* M_PI + atan( - p.at( 0 ) / p.at( 1 ) );
}
else // ( p.at( 0 ) >= p.at( 1 ) )
{
if ( p.at( 0 ) >= -p.at( 1 ) )
angle = 0.5*M_PI - atan( p.at( 0 ) / p.at( 1 ) );
else
angle = M_PI + atan( p.at( 1 ) / p.at( 0 ) );
}
angle = ( angle < 0.0 ) ? angle + 2*M_PI : angle;
return angle;
}
template<typename T >
void DGtal::AccFlower2D< T >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Reimplemented from DGtal::StarShaped2D< TSpace >.

Definition at line 212 of file AccFlower2D.ih.

{
out << "[AccFlower2D] center= "<<myCenter<<" radius="<<myRadius<<" smallradius="<<myVarRadius
<<" myK="<<myK<<" phase-shift="<<myPhi;
}
template<typename T >
DGtal::AccFlower2D< T >::RealPoint2D DGtal::AccFlower2D< T >::x ( const double  t) const
inlinevirtual
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 >.

Definition at line 134 of file AccFlower2D.ih.

References M_PI.

{
double tt =t;
while ( tt >= M_PI ) tt -= 2 * M_PI;
while ( tt < -M_PI ) tt += 2 * M_PI;
double ktn = myKp * tt * tt * tt;
double r = myRadius + myVarRadius * cos( ktn );
RealPoint2D c( r * cos( tt ), r * sin( tt ) );
c += myCenter;
return c;
}
template<typename T >
DGtal::AccFlower2D< T >::RealVector2D DGtal::AccFlower2D< T >::xp ( const double  tt) const
inlinevirtual
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 >.

Definition at line 157 of file AccFlower2D.ih.

References M_PI.

{
double t= tt;
while ( t >= M_PI ) t -= 2 * M_PI;
while ( t < -M_PI ) t += 2 * M_PI;
double ktn = myKp * t * t * t;
double ktnp = 3 * myKp * t * t ;
double r = myRadius + myVarRadius * cos( ktn );
double rp = - myVarRadius * sin( ktn ) * ktnp;
RealPoint2D c( rp * cos( t ) - r * sin( t ),
rp * sin( t ) + r * cos( t ) );
return c;
}
template<typename T >
DGtal::AccFlower2D< T >::RealVector2D DGtal::AccFlower2D< T >::xpp ( const double  tt) const
inlinevirtual
Parameters:
tany angle between 0 and 2*Pi.
Returns:
the vector (x''(t),y''(t)).

Implements DGtal::StarShaped2D< TSpace >.

Definition at line 181 of file AccFlower2D.ih.

References M_PI.

{
double t=tt;
while ( t >= M_PI ) t -= 2 * M_PI;
while ( t < -M_PI ) t += 2 * M_PI;
double ktn = myKp * t * t * t;
double ktnp = 3 * myKp * t * t;
double ktnpp = 6 * myKp * t;
double r = myRadius + myVarRadius * cos( ktn );
double rp = - myVarRadius * sin( ktn ) * ktnp;
double rpp = - myVarRadius * cos( ktn ) * ktnp * ktnp -
myVarRadius * sin( ktn ) * ktnpp;
RealPoint2D c( rpp * cos( t ) - 2 * rp * sin( t ) - r * cos( t ),
rpp * sin( t ) + 2 * rp * cos( t ) - r * sin( t ) );
return c;
}

Field Documentation

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

the number of flower extremeties.

Definition at line 208 of file AccFlower2D.h.

Referenced by DGtal::AccFlower2D< TSpace >::AccFlower2D().

template<typename TSpace>
double DGtal::AccFlower2D< TSpace >::myKp
private

The value 2*myK*Pi/(Pi^3)

Definition at line 213 of file AccFlower2D.h.

Referenced by DGtal::AccFlower2D< TSpace >::AccFlower2D().

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

the phase of the flower (in radian).

Definition at line 218 of file AccFlower2D.h.

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

Radius of the flower.

Definition at line 198 of file AccFlower2D.h.

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

template<typename TSpace>
double DGtal::AccFlower2D< TSpace >::myVarRadius
private

the variable small radius of the flower.

Definition at line 203 of file AccFlower2D.h.

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


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