OFELI's Logo

An Object Oriented Finite Element Library

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

#include <Figure.h>

+ Inheritance diagram for Polygon:

Public Member Functions

 polygon ()
 Default constructor.
 
 Polygon (const Vect< Point< real_t > > &v, int code=1)
 Constructor. More...
 
void setVertices (const Vect< Point< real_t > > &v)
 Assign vertices of polygon. More...
 
real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance of a given point from the current polygon. More...
 
Polygonoperator+= (Point< real_t > a)
 Operator +=. More...
 
Polygonoperator+= (real_t a)
 Operator *=. More...
 
virtual real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance from a given point to current figure. More...
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points. More...
 
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. More...
 
- 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.
 
virtual real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance from a given point to current figure. More...
 
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. More...
 
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. More...
 

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/3]

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/3]

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

Return signed distance from a given point to current figure.

Parameters
[in]pPoint instance from which distance is computed

Reimplemented from Figure.

◆ getSignedDistance() [3/3]

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





Copyright © 1998-2022 Rachid Touzani