MLIB
|
Representation of a simple, non-intersecting polygon that partitions the 2D space in two regions. More...
Public Member Functions | |
Border () | |
Create an empty border object. | |
Border (const char *fname) | |
Load a border object from a text file. | |
void | add (double x, double y) |
void | close (double x, double y) |
bool | inside (double x, double y) |
Check if a point is inside the border. | |
Representation of a simple, non-intersecting polygon that partitions the 2D space in two regions.
The polygon is represented by its vertexes and it is always assumed that there is a segment joining the last point with the first point. A Border object can be stored in a text file where each line represents a vertex. The last vertex defines what is considered the "inside" of the polygon: if the point lays inside the polygon, it is an "island" border. If the last point is outside the polygon, it is a "hole" border.
bool mlib::Border::inside | ( | double | x, |
double | y | ||
) |
Check if a point is inside the border.
x | - X coordinate of the point |
y | - Y coordinate of the point |
Algorithm adapted from W. Randolph Franklin wrf@e.nosp@m.cse..nosp@m.rpi.e.nosp@m.du http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html