Plugins
Loading...
Searching...
No Matches
ug::d3f::PolygonalRegions::t_polygon_item Class Reference

Public Member Functions

void append (number x, number y)
 appends a point at the end of the list
 
bool is_valid () const
 checks whether the points specify a proper polygon
 
bool pnt_inside (number x, number y) const
 checks whether a point is in the polygon
 
 t_polygon_item (int the_id, number x, number y, t_polygon_item *the_tl=NULL)
 constructor: we need at least one point!
 

Public Attributes

MathVector< 2 > bb [2]
 bounding box
 
std::vector< MathVector< 2 > > corner
 corners
 
int id
 identifier of the polygon
 
t_polygon_itemtl
 next polygon
 

Private Member Functions

bool pnt_inside_CN (const MathVector< 2 > pnt) const
 checks whether a point is in the polygon
 
bool pnt_inside_WN (const MathVector< 2 > pnt) const
 checks whether a point is in the polygon
 
bool pnt_is_on_the_left (const MathVector< 2 > &pnt_0, const MathVector< 2 > &pnt_1, const MathVector< 2 > &pnt) const
 checks the position of a point wrt a line
 

Constructor & Destructor Documentation

◆ t_polygon_item()

ug::d3f::PolygonalRegions::t_polygon_item::t_polygon_item ( int  the_id,
number  x,
number  y,
t_polygon_item the_tl = NULL 
)
inline

constructor: we need at least one point!

References bb, and corner.

Member Function Documentation

◆ append()

void ug::d3f::PolygonalRegions::t_polygon_item::append ( number  x,
number  y 
)

appends a point at the end of the list

Adds a point at the end of the list of corners of the polygon. Updates the bounding box.

References bb, and corner.

Referenced by ug::d3f::PolygonalRegions::append_point().

◆ is_valid()

bool ug::d3f::PolygonalRegions::t_polygon_item::is_valid ( ) const
inline

checks whether the points specify a proper polygon

References corner.

◆ pnt_inside()

bool ug::d3f::PolygonalRegions::t_polygon_item::pnt_inside ( number  x,
number  y 
) const
inline

checks whether a point is in the polygon

References pnt_inside_WN().

◆ pnt_inside_CN()

bool ug::d3f::PolygonalRegions::t_polygon_item::pnt_inside_CN ( const MathVector< 2 >  pnt) const
private

checks whether a point is in the polygon

Checks whether a given point is in a given element. The function returns false if no, true if yes. This is an implementation of the crossing-number algorithm taken from http://geomalgorithms.com/a03-_inclusion.html (Copyright 2000 softSurfer, 2012 Dan Sunday, free for public use)

Parameters
pntthe point

◆ pnt_inside_WN()

bool ug::d3f::PolygonalRegions::t_polygon_item::pnt_inside_WN ( const MathVector< 2 >  pnt) const
private

checks whether a point is in the polygon

Checks whether a given point is in 'this' polygon. The function returns false if no, true if yes. This is an implementation of the winding-number algorithm taken from http://geomalgorithms.com/a03-_inclusion.html (Copyright 2000 softSurfer, 2012 Dan Sunday, free for public use)

Parameters
pntthe point

References ug::MathVector< std::size_t N, typename T >::size().

Referenced by pnt_inside().

◆ pnt_is_on_the_left()

bool ug::d3f::PolygonalRegions::t_polygon_item::pnt_is_on_the_left ( const MathVector< 2 > &  pnt_0,
const MathVector< 2 > &  pnt_1,
const MathVector< 2 > &  pnt 
) const
inlineprivate

checks the position of a point wrt a line

Tests if a point is left or right of an infinite straight line. Return true if pnt is left of the line or on the line, false otherwise.

Parameters
pnt_0one point on the line
pnt_1another point on the line
pntpoint to check

Member Data Documentation

◆ bb

MathVector<2> ug::d3f::PolygonalRegions::t_polygon_item::bb[2]

bounding box

Referenced by append(), and t_polygon_item().

◆ corner

std::vector<MathVector<2> > ug::d3f::PolygonalRegions::t_polygon_item::corner

corners

Referenced by append(), is_valid(), and t_polygon_item().

◆ id

int ug::d3f::PolygonalRegions::t_polygon_item::id

identifier of the polygon

Referenced by ug::d3f::PolygonalRegions::polygon_by_id().

◆ tl


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