BG_Flood
0.8
Documentation (Work-in-progress)
|
#include "Poly.h"
Functions | |
template<class T > | |
T | isLeft (T P0x, T P0y, T P1x, T P1y, T P2x, T P2y) |
isLeft(): tests if a point is Left|On|Right of an infinite line. More... | |
template<class T , class F > | |
int | cn_PnPoly (T Px, T Py, F *Vx, F *Vy, int n) |
cn_PnPoly(): crossing number test for a point in a polygon More... | |
template<class T > | |
int | wn_PnPoly (T Px, T Py, T *Vx, T *Vy, unsigned int n) |
winding number test for a point in a polygon More... | |
template<class T > | |
int | wn_PnPoly (T Px, T Py, Polygon Poly) |
winding number test for a point in a polygon More... | |
template int | wn_PnPoly< float > (float Px, float Py, Polygon Poly) |
template int | wn_PnPoly< double > (double Px, double Py, Polygon Poly) |
Polygon | CounterCWPoly (Polygon Poly) |
check polygon handedness and reverse if necessary. More... | |
Vertex | VertAdd (Vertex A, Vertex B) |
Vertex Add. More... | |
Vertex | VertSub (Vertex A, Vertex B) |
Vertex Substract. More... | |
double | dotprod (Vertex A, Vertex B) |
Vertex dot product. More... | |
double | xprod (Vertex A, Vertex B) |
Vertex cross-product. More... | |
bool | SegmentIntersect (Polygon P, Polygon Q) |
Intersection between segments. More... | |
bool | PolygonIntersect (Polygon P, Polygon Q) |
Intersection between 2 polygons. More... | |
template<class T > | |
bool | blockinpoly (T xo, T yo, T dx, int blkwidth, Polygon Poly) |
check whether a block is inside or intersectin a polygon More... | |
template bool | blockinpoly< float > (float xo, float yo, float dx, int blkwidth, Polygon Poly) |
template bool | blockinpoly< double > (double xo, double yo, double dx, int blkwidth, Polygon Poly) |
bool | test_wninpoly () |
Test winding number inpoly function. More... | |
bool | test_SegmentIntersect () |
Test segment intersect function. More... | |
bool | test_intersectpoly () |
Test polygon intersect function. More... | |
bool blockinpoly | ( | T | xo, |
T | yo, | ||
T | dx, | ||
int | blkwidth, | ||
Polygon | Poly | ||
) |
template bool blockinpoly< double > | ( | double | xo, |
double | yo, | ||
double | dx, | ||
int | blkwidth, | ||
Polygon | Poly | ||
) |
template bool blockinpoly< float > | ( | float | xo, |
float | yo, | ||
float | dx, | ||
int | blkwidth, | ||
Polygon | Poly | ||
) |
int cn_PnPoly | ( | T | Px, |
T | Py, | ||
F * | Vx, | ||
F * | Vy, | ||
int | n | ||
) |
cn_PnPoly(): crossing number test for a point in a polygon
cn_PnPoly(): crossing number test for a point in a polygon Input: P = a point, V[] = vertex points of a polygon V[n+1] with V[n]=V[0] Return: 0 = outside, 1 = inside
Copyright 2000 softSurfer, 2012 Dan Sunday
This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application. Code modified to fit the use in DisperGPU
This code is patterned after [Franklin, 2000]
int isLeft | ( | T | P0x, |
T | P0y, | ||
T | P1x, | ||
T | P1y, | ||
T | P2x, | ||
T | P2y | ||
) |
isLeft(): tests if a point is Left|On|Right of an infinite line.
isLeft(): tests if a point is Left|On|Right of an infinite line. Input: three points P0, P1, and P2 Return: >0 for P2 left of the line through P0 and P1 =0 for P2 on the line <0 for P2 right of the line See: Algorithm 1 "Area of Triangles and Polygons"
Copyright 2000 softSurfer, 2012 Dan Sunday
This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application. Code modified to fit the use in DisperGPU
Intersection between 2 polygons.
Check whether 2 polygons intersect. The function checks whether each segment of Polygon P intersect any segment of Poly Q. if an intersect is detected theh loops are broken and true is returned.
Intersection between segments.
Check whether 2 polygon segment intersect. Polygon P and Q are only 2 vertex long each. i.e. they represent a segment each.
https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect Best answer from Gareth Rees
bool test_intersectpoly | ( | ) |
Test polygon intersect function.
bool test_SegmentIntersect | ( | ) |
Test segment intersect function.
bool test_wninpoly | ( | ) |
Test winding number inpoly function.
int wn_PnPoly | ( | T | Px, |
T | Py, | ||
Polygon | Poly | ||
) |
winding number test for a point in a polygon
wn_PnPoly(): winding number test for a point in a polygon Input: P = a point, V[] = vertex points of a polygon V[n+1] with V[n]=V[0] Return: wn = the winding number (=0 only when P is outside)
Copyright 2000 softSurfer, 2012 Dan Sunday
This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application. Code modified to fit the use in DisperGPU
int wn_PnPoly | ( | T | Px, |
T | Py, | ||
T * | Vx, | ||
T * | Vy, | ||
unsigned int | n | ||
) |
winding number test for a point in a polygon
wn_PnPoly(): winding number test for a point in a polygon Input: P = a point, V[] = vertex points of a polygon V[n+1] with V[n]=V[0] Return: wn = the winding number (=0 only when P is outside)
Copyright 2000 softSurfer, 2012 Dan Sunday
This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application. Code modified to fit the use in DisperGPU