codac 1.5.6
|
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. | |
PdcInPolygon (std::vector< std::vector< double > > &vertices) | |
Create the predicate with the list of segments passed as argument. | |
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. | |
virtual BoolInterval | test (const IntervalVector &box) |
Test the box. | |
Protected Attributes | |
std::vector< double > | ax |
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
-
B
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.
points | list 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)), ...) |
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.
vertices | list of segments representing the edges of the polygon in the format of ( (a_x, a_y), (b_x, b_x), (c_x, c_y), ...) |
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.
ax | list of x coordinate of the first point of each segment |
ay | list of y coordinate of the first point of each segment |
bx | list of x coordinate of the second point of each segment |
by | list of y coordinate of the second point of each segment |
|
virtual |
Test the box.
box | to be tested |
|
protected |
Definition of the segment of the polygon