DGtal  1.4.beta
DGtal::StarShaped2D< TSpace > Class Template Referenceabstract

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

Inheritance diagram for DGtal::StarShaped2D< TSpace >:
[legend]

Public Types

typedef TSpace Space
 
typedef Space::RealPoint RealPoint
 

Public Member Functions

 StarShaped2D ()=default
 
 StarShaped2D (const StarShaped2D &other)=delete
 
StarShaped2Doperator= (const StarShaped2D &other)=delete
 
virtual ~StarShaped2D ()=default
 
virtual RealPoint interiorPoint () const
 
virtual RealPoint getLowerBound () const =0
 
virtual RealPoint getUpperBound () const =0
 
virtual RealPoint center () const =0
 
virtual void moveTo (const RealPoint &newCenter)=0
 
virtual double parameter (const RealPoint &p) const =0
 
virtual RealPoint x (const double t) const =0
 
virtual RealPoint xp (const double t) const =0
 
virtual RealPoint xpp (const double t) const =0
 
Orientation orientation (const RealPoint &p) const
 
RealPoint tangent (const double t) const
 
RealPoint normal (const double t) const
 
double curvature (const double t) const
 
double arclength (const double t1, double t2, const 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
 

Private Member Functions

template<typename T >
bool isAlmostEqual (T x, T y) const
 

Detailed Description

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

Description of template class 'StarShaped2D'

Aim: Abstract class that represents any star-shaped object in dimension 2. Such a shape as a center and any segment from this center to the shape boundary is included in the shape. These shapes can thus be parameterized by an angle 't' turning around the center.

StarShaped2D and its derived classes are models of CEuclideanBoundedShape and CEuclideanOrientedShape.

NB: A backport from ImaGene.

Template Parameters
TSpacespace in which the shape is defined.

Definition at line 74 of file StarShaped2D.h.

Member Typedef Documentation

◆ RealPoint

template<typename TSpace >
typedef Space::RealPoint DGtal::StarShaped2D< TSpace >::RealPoint

Definition at line 79 of file StarShaped2D.h.

◆ Space

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

Definition at line 78 of file StarShaped2D.h.

Constructor & Destructor Documentation

◆ StarShaped2D() [1/2]

template<typename TSpace >
DGtal::StarShaped2D< TSpace >::StarShaped2D ( )
default

Constructor.

◆ StarShaped2D() [2/2]

template<typename TSpace >
DGtal::StarShaped2D< TSpace >::StarShaped2D ( const StarShaped2D< TSpace > &  other)
delete

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

◆ ~StarShaped2D()

template<typename TSpace >
virtual DGtal::StarShaped2D< TSpace >::~StarShaped2D ( )
virtualdefault

Destructor.

Member Function Documentation

◆ arclength()

template<typename TSpace >
double DGtal::StarShaped2D< TSpace >::arclength ( const double  t1,
double  t2,
const unsigned int  nb 
) const
Parameters
t1any angle between 0 and 2*Pi.
t2any angle between 0 and 2*Pi, further from [t1].
nbthe number of points used to estimate the arclength between x(t1) and x(t2).
Returns
the estimated arclength.

◆ center()

◆ closestPointWithWitnesses()

template<typename TSpace >
RealPoint DGtal::StarShaped2D< TSpace >::closestPointWithWitnesses ( const RealPoint p,
const RealPoint left,
const RealPoint right,
const int  step 
) const

Return a point that lies between the projection of left and right and that is the closest regarding the \(L_2\) norm

Parameters
pthe point to be projected
lefta point that is supposed to be projected left of p (regarding the angle)
righta point that is supposed to be projected right of p (regarding the angle)
stepprecision of the approximation
Returns
a point.

Referenced by test_shape().

◆ curvature()

template<typename TSpace >
double DGtal::StarShaped2D< TSpace >::curvature ( const double  t) const
Parameters
tany angle between 0 and 2*Pi.
Returns
the algebraic curvature at point (x(t),y(t)), positive is convex, negative is concave when shape is to the left and the shape boundary is followed counterclockwise.

◆ findIntersection()

template<typename TSpace >
RealPoint DGtal::StarShaped2D< TSpace >::findIntersection ( const RealPoint inner,
const RealPoint outer,
const double  epsilon 
) const

Return a point on the segment [inner;outer] that is at most \(\epsilon\) from the shape in \(L_2\) norm.

Parameters
innera point that is inside the shape
outera point that is outside the shape
epsilonerror parameter
Returns
the intersected point.

Referenced by test_shape().

◆ getLowerBound()

template<typename TSpace >
virtual RealPoint DGtal::StarShaped2D< TSpace >::getLowerBound ( ) const
pure virtual

◆ getUpperBound()

template<typename TSpace >
virtual RealPoint DGtal::StarShaped2D< TSpace >::getUpperBound ( ) const
pure virtual

◆ interiorPoint()

template<typename TSpace >
virtual RealPoint DGtal::StarShaped2D< TSpace >::interiorPoint ( ) const
inlinevirtual
Returns
a point p such that 'isInside(p)' returns 'true'.

Definition at line 111 of file StarShaped2D.h.

112  {
113  return center();
114  }
virtual RealPoint center() const =0

References DGtal::StarShaped2D< TSpace >::center().

◆ isAlmostEqual()

template<typename TSpace >
template<typename T >
bool DGtal::StarShaped2D< TSpace >::isAlmostEqual ( x,
y 
) const
inlineprivate

Equality test using relative tolerance.

Definition at line 267 of file StarShaped2D.h.

268  {
269  return std::abs(x - y) <= std::numeric_limits<T>::epsilon();
270  }

◆ isValid()

template<typename TSpace >
bool DGtal::StarShaped2D< TSpace >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ moveTo()

template<typename TSpace >
virtual void DGtal::StarShaped2D< TSpace >::moveTo ( const RealPoint newCenter)
pure virtual

Move the center of the star-shaped object to a new position

Parameters
newCenterthe new center position

Implemented in DGtal::NGon2D< TSpace >, DGtal::Lemniscate2D< TSpace >, DGtal::Flower2D< TSpace >, DGtal::Ellipse2D< TSpace >, DGtal::Ball2D< TSpace >, DGtal::Astroid2D< TSpace >, DGtal::Astroid2D< Space >, and DGtal::AccFlower2D< TSpace >.

◆ normal()

template<typename TSpace >
RealPoint DGtal::StarShaped2D< TSpace >::normal ( const double  t) const
Parameters
tany angle between 0 and 2*Pi.
Returns
the vector (x''(t),y''(t)) made unitary which is the unit normal to the shape boundary looking inside the shape.

◆ operator=()

template<typename TSpace >
StarShaped2D& DGtal::StarShaped2D< TSpace >::operator= ( const StarShaped2D< TSpace > &  other)
delete

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

◆ orientation()

template<typename TSpace >
Orientation DGtal::StarShaped2D< TSpace >::orientation ( const RealPoint p) const

Return the orienatation of a point with respect to a shape.

Parameters
pinput point
Returns
the orientation of the point (INSIDE ON or OUTSIDE).

◆ parameter()

template<typename TSpace >
virtual double DGtal::StarShaped2D< TSpace >::parameter ( const RealPoint p) const
pure virtual
Parameters
pany point in the plane.
Returns
the angle parameter between 0 and 2*Pi corresponding to this point for the shape.

Implemented in DGtal::NGon2D< TSpace >, DGtal::Lemniscate2D< TSpace >, DGtal::Flower2D< TSpace >, DGtal::Ellipse2D< TSpace >, DGtal::Ball2D< TSpace >, DGtal::Astroid2D< TSpace >, DGtal::Astroid2D< Space >, and DGtal::AccFlower2D< TSpace >.

◆ selfDisplay()

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

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ tangent()

template<typename TSpace >
RealPoint DGtal::StarShaped2D< TSpace >::tangent ( const double  t) const
Parameters
tany angle between 0 and 2*Pi.
Returns
the vector (x'(t),y'(t)) made unitary which is the unit tangent to the shape boundary.

◆ x()

template<typename TSpace >
virtual RealPoint DGtal::StarShaped2D< TSpace >::x ( const double  t) const
pure virtual
Parameters
tany angle between 0 and 2*Pi.
Returns
the vector (x(t),y(t)) which is the position on the shape boundary.

Implemented in DGtal::NGon2D< TSpace >, DGtal::Lemniscate2D< TSpace >, DGtal::Flower2D< TSpace >, DGtal::Ellipse2D< TSpace >, DGtal::Ball2D< TSpace >, DGtal::Astroid2D< TSpace >, DGtal::Astroid2D< Space >, and DGtal::AccFlower2D< TSpace >.

◆ xp()

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

Implemented in DGtal::NGon2D< TSpace >, DGtal::Lemniscate2D< TSpace >, DGtal::Flower2D< TSpace >, DGtal::Ellipse2D< TSpace >, DGtal::Ball2D< TSpace >, DGtal::Astroid2D< TSpace >, DGtal::Astroid2D< Space >, and DGtal::AccFlower2D< TSpace >.

◆ xpp()

template<typename TSpace >
virtual RealPoint DGtal::StarShaped2D< TSpace >::xpp ( const double  t) const
pure virtual

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