• If the polygon is given by 3D points, set the flag hasZ to true. The z component will be discarded.

    Usage:

    const polygon = [1, 1,  1, 2,  2, 2,  2, 1]
    console.log( pointInPolygon(1.5, 1.5, polygon)) // true
    console.log( pointInPolygon(4.9, 1.2, polygon)) // false
    console.log( pointInPolygon(1.8, 1.1, polygon)) // true

    Note

    based on https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html

    Parameters

    • x: number
    • y: number
    • polyline: Serie<IArray>

    Returns boolean