Mir 1.0
Mir application programming interface
Computational geometry

Functions

mirkl_bool_t mirml_geom_pnpoly (unsigned int nvert, double *vertx, double *verty, double testx, double testy)
 Point inclusion in polygon test. More...
 
mirkl_bool_t mirml_geom_pnpoly_int64v (unsigned int ncoord, mirkl_int64_t *vcoord, mirkl_int64_t testx, mirkl_int64_t testy)
 
int mirml_geom_rect_circle_itest (double rx, double ry, double rw, double rh, double ccx, double ccy, double cr, double *drmin, double *drmax)
 

Detailed Description

Function Documentation

◆ mirml_geom_pnpoly()

mirkl_bool_t mirml_geom_pnpoly ( unsigned int  nvert,
double *  vertx,
double *  verty,
double  testx,
double  testy 
)

Point inclusion in polygon test.

Note
See details of the method here: https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
Parameters
[in]nvertNumber of vertices in the polygon.
[in]vertx,vertyArrays containing the x- and y-coordinates of the polygon's vertices.
[in]testx,testyx- and y-coordinate of the test point.
Returns
1 if point is in polygon, otherwise 0.

◆ mirml_geom_pnpoly_int64v()

mirkl_bool_t mirml_geom_pnpoly_int64v ( unsigned int  ncoord,
mirkl_int64_t *  vcoord,
mirkl_int64_t  testx,
mirkl_int64_t  testy 
)

Version of mirml_geom_pnpoly for signed 64-bit integer numbers.

Note
Coordinates of vertices are in single array vcoord in order x0,y0,x1,y1, etc.
Parameters
ncoordTotal number of coordinates in vcoord. Must be even.

◆ mirml_geom_rect_circle_itest()

int mirml_geom_rect_circle_itest ( double  rx,
double  ry,
double  rw,
double  rh,
double  ccx,
double  ccy,
double  cr,
double *  drmin,
double *  drmax 
)

Rectangle-circle intersection test. Rectangle is defined by coordinates of its top-left vertex (assuming that +x is to the right and +y is downwards) and its width and height.

Parameters
drmin,drmaxIf not NULL the minimal and maximal distances from circle center to the rectangle are set.
Returns
1 if rectangle is completely inside the circle, -1 if the rectangle is completely outside the circle, 0 if they intersect.
Note
The function returns 0 and rmin=0.0 if the circle is inside the rectangle.