Skip to content

File Poly.h

FileList > src > Poly.h

Go to the source code of this file

  • #include "General.h"
  • #include "Param.h"
  • #include "Input.h"
  • #include "Write_txtlog.h"
  • #include "Util_CPU.h"
  • #include "Forcing.h"
  • #include "Arrays.h"
  • #include "MemManagement.h"

Public Functions

Type Name
Polygon CounterCWPoly (Polygon Poly)
check polygon handedness and reverse if necessary.
bool blockinpoly (T xo, T yo, T dx, int blkwidth, Polygon Poly)
Check whether a block is inside or intersects a polygon.
int wn_PnPoly (T Px, T Py, Polygon Poly)
winding number test for a point in a polygon

Public Functions Documentation

function CounterCWPoly

check polygon handedness and reverse if necessary.

Polygon CounterCWPoly (
    Polygon Poly
) 

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())


function blockinpoly

Check whether a block is inside or intersects a polygon.

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

Determines if any corner of the block is inside the polygon or if the block intersects the polygon.

Template parameters:

  • T Coordinate type

Parameters:

  • xo Block origin x
  • yo Block origin y
  • dx Block cell size
  • blkwidth Block width
  • Poly Polygon to test

Returns:

True if block is inside or intersects polygon, false otherwise


function wn_PnPoly

winding number test for a point in a polygon

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

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



The documentation for this class was generated from the following file src/Poly.h