To store and treat a polygonal figure. More...

#include <Figure.h>

Inheritance diagram for Polygon:
Figure

Public Member Functions

 polygon ()
 Default constructor.
 
 Polygon (const Vect< Point< real_t > > &v, int code=1)
 Constructor.
 
void setVertices (const Vect< Point< real_t > > &v)
 Assign vertices of polygon.
 
real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance of a given point from the current polygon.
 
Polygonoperator+= (Point< real_t > a)
 Operator +=.
 
Polygonoperator+= (real_t a)
 Operator *=.
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points.
 
real_t dLine (const Point< real_t > &p, const Point< real_t > &a, const Point< real_t > &b) const
 Compute signed distance from a line.
 
- Public Member Functions inherited from Figure
 Figure ()
 Default constructor.
 
 Figure (const Figure &f)
 Copy constructor.
 
virtual ~Figure ()
 Destructor.
 
void setCode (int code)
 Choose a code for the domain defined by the figure.
 
Figureoperator= (const Figure &f)
 Operator =.
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points.
 
real_t dLine (const Point< real_t > &p, const Point< real_t > &a, const Point< real_t > &b) const
 Compute signed distance from a line.
 

Detailed Description

To store and treat a polygonal figure.

Constructor & Destructor Documentation

◆ Polygon()

Polygon ( const Vect< Point< real_t > > & v,
int code = 1 )

Constructor.

Parameters
[in]vVect instance containing list of coordinates of polygon vertices
[in]codeCode to assign to the generated domain (Default value = 1)

Member Function Documentation

◆ dLine()

real_t dLine ( const Point< real_t > & p,
const Point< real_t > & a,
const Point< real_t > & b ) const

Compute signed distance from a line.

Parameters
[in]pPoint for which distance is computed
[in]aFirst vertex of line
[in]bSecond vertex of line
Returns
Signed distance

◆ getSignedDistance() [1/2]

void getSignedDistance ( const Grid & g,
Vect< real_t > & d ) const

Calculate signed distance to current figure with respect to grid points.

Parameters
[in]gGrid instance
[in]dVect instance containing calculated distance from each grid index to Figure
Remarks
Vector d doesn't need to be sized before invoking this function

◆ getSignedDistance() [2/2]

real_t getSignedDistance ( const Point< real_t > & p) const
virtual

Return signed distance of a given point from the current polygon.

The computed distance is negative if p lies in the polygon, negative if it is outside, and 0 on its boundary

Parameters
[in]pPoint<double> instance

Reimplemented from Figure.

◆ operator+=() [1/2]

Polygon & operator+= ( Point< real_t > a)

Operator +=.

Translate polygon by a vector a

◆ operator+=() [2/2]

Polygon & operator+= ( real_t a)

Operator *=.

Scale polygon by a factor a

◆ setVertices()

void setVertices ( const Vect< Point< real_t > > & v)

Assign vertices of polygon.

Parameters
[in]vVector containing vertices coordinates in counter clockwise order