codac
Public Member Functions | Protected Attributes | List of all members
codac::PdcInPolygon Class Reference

Tests if a box is inside a polygon. More...

#include <codac_PdcInPolygon.h>

Inherits Pdc.

Public Member Functions

 PdcInPolygon (std::vector< std::vector< std::vector< double > > > &points)
 Create the predicate with the list of segments passed as argument. More...
 
 PdcInPolygon (std::vector< std::vector< double > > &vertices)
 Create the predicate with the list of segments passed as argument. More...
 
 PdcInPolygon (std::vector< double > &ax, std::vector< double > &ay, std::vector< double > &bx, std::vector< double > &by)
 Create the predicate with the list of segments passed as argument. More...
 
virtual BoolInterval test (const IntervalVector &box)
 Test the box. More...
 

Protected Attributes

std::vector< double > ax
 

Detailed Description

Tests if a box is inside a polygon.

The test is based on the Winding Number (see .http://en.wikipedia.org/wiki/Winding_number) But fastest method can be found in http://alienryderflex.com/polygon

The polygon is not necessarily convex.

The polygon is defined by an union of oriented segment given in counter-clockwise order.

Example : The polygon ABCDE is composed of 5 segments AB – BC – CD – DE – EA

A----------------------------— E

Constructor & Destructor Documentation

◆ PdcInPolygon() [1/3]

codac::PdcInPolygon::PdcInPolygon ( std::vector< std::vector< std::vector< double > > > &  points)

Create the predicate with the list of segments passed as argument.

A polygon is defined as an union of segments given in a counter-clockwise order. See the documentation for an example of usage.

Parameters
pointslist of segments representing the edges of the polygon in the format of ( ((a1_x, a1_y), (b1_x, b1_x)), ((a2_x, a2_y), (b2_x, b2_x)), ...)

◆ PdcInPolygon() [2/3]

codac::PdcInPolygon::PdcInPolygon ( std::vector< std::vector< double > > &  vertices)

Create the predicate with the list of segments passed as argument.

A polygon is defined as an union of segments given in a counter-clockwise order. See the documentation for an example of usage.

Parameters
verticeslist of segments representing the edges of the polygon in the format of ( (a_x, a_y), (b_x, b_x), (c_x, c_y), ...)

◆ PdcInPolygon() [3/3]

codac::PdcInPolygon::PdcInPolygon ( std::vector< double > &  ax,
std::vector< double > &  ay,
std::vector< double > &  bx,
std::vector< double > &  by 
)

Create the predicate with the list of segments passed as argument.

A polygon is defined as an union of segments given in a counter-clockwise order. See the documentation for an example of usage.

Parameters
axlist of x coordinate of the first point of each segment
aylist of y coordinate of the first point of each segment
bxlist of x coordinate of the second point of each segment
bylist of y coordinate of the second point of each segment

Member Function Documentation

◆ test()

virtual BoolInterval codac::PdcInPolygon::test ( const IntervalVector &  box)
virtual

Test the box.

Parameters
boxto be tested
Returns
YES if the point is inside the close polygon, NO if outside, else MAYBE.

Member Data Documentation

◆ ax

std::vector<double> codac::PdcInPolygon::ax
protected

Definition of the segment of the polygon


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