MLIB
Loading...
Searching...
No Matches
mlib::Border Class Reference

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.
 

Detailed Description

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.

Member Function Documentation

◆ inside()

bool mlib::Border::inside ( double  x,
double  y 
)

Check if a point is inside the border.

Parameters
x- X coordinate of the point
y- Y coordinate of the point
Returns
true if point is inside the border

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


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