BG_Flood  0.8
Documentation (Work-in-progress)
Poly.cu File Reference
#include "Poly.h"
Include dependency graph for Poly.cu:

Functions

template<class 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...
 

Function Documentation

◆ blockinpoly()

template<class T >
bool blockinpoly ( xo,
yo,
dx,
int  blkwidth,
Polygon  Poly 
)

check whether a block is inside or intersectin a polygon

Description

Check whether a block is inside or intersectin a polygon

◆ blockinpoly< double >()

template bool blockinpoly< double > ( double  xo,
double  yo,
double  dx,
int  blkwidth,
Polygon  Poly 
)

◆ blockinpoly< float >()

template bool blockinpoly< float > ( float  xo,
float  yo,
float  dx,
int  blkwidth,
Polygon  Poly 
)

◆ cn_PnPoly()

template<class T , class F >
int cn_PnPoly ( Px,
Py,
F *  Vx,
F *  Vy,
int  n 
)

cn_PnPoly(): crossing number test for a point in a polygon

Description

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

Where does this come from:

Copyright 2000 softSurfer, 2012 Dan Sunday

Original Licence

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]

◆ CounterCWPoly()

Polygon CounterCWPoly ( Polygon  Poly)

check polygon handedness and reverse if necessary.

Description

check polygon handedness and enforce left-handesness (Counter-clockwise). This function is used to ensure the right polygon handedness for the winding number inpoly (using the isleft())

◆ dotprod()

double dotprod ( Vertex  A,
Vertex  B 
)

Vertex dot product.

◆ isLeft()

template<class T >
int isLeft ( P0x,
P0y,
P1x,
P1y,
P2x,
P2y 
)

isLeft(): tests if a point is Left|On|Right of an infinite line.

Description

a Point is defined by its coordinates {int x, y;}

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"

Where does this come from:

Copyright 2000 softSurfer, 2012 Dan Sunday

Original Licence

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

◆ PolygonIntersect()

bool PolygonIntersect ( Polygon  P,
Polygon  Q 
)

Intersection between 2 polygons.

Description

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.

◆ SegmentIntersect()

bool SegmentIntersect ( Polygon  P,
Polygon  Q 
)

Intersection between segments.

Description

Check whether 2 polygon segment intersect. Polygon P and Q are only 2 vertex long each. i.e. they represent a segment each.

Where does this come from:

https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect Best answer from Gareth Rees

◆ test_intersectpoly()

bool test_intersectpoly ( )

Test polygon intersect function.

◆ test_SegmentIntersect()

bool test_SegmentIntersect ( )

Test segment intersect function.

◆ test_wninpoly()

bool test_wninpoly ( )

Test winding number inpoly function.

◆ VertAdd()

Vertex VertAdd ( Vertex  A,
Vertex  B 
)

Vertex Add.

◆ VertSub()

Vertex VertSub ( Vertex  A,
Vertex  B 
)

Vertex Substract.

◆ wn_PnPoly() [1/2]

template<class T >
int wn_PnPoly ( Px,
Py,
Polygon  Poly 
)

winding number test for a point in a polygon

Description

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)

Where does this come from:

Copyright 2000 softSurfer, 2012 Dan Sunday

Original Licence

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

◆ wn_PnPoly() [2/2]

template<class T >
int wn_PnPoly ( Px,
Py,
T *  Vx,
T *  Vy,
unsigned int  n 
)

winding number test for a point in a polygon

Description

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)

Where does this come from:

Copyright 2000 softSurfer, 2012 Dan Sunday

Original Licence

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

◆ wn_PnPoly< double >()

template int wn_PnPoly< double > ( double  Px,
double  Py,
Polygon  Poly 
)

◆ wn_PnPoly< float >()

template int wn_PnPoly< float > ( float  Px,
float  Py,
Polygon  Poly 
)

◆ xprod()

double xprod ( Vertex  A,
Vertex  B 
)

Vertex cross-product.