Returns true if coordinate is within polygon

@param LatLng $coord
@param bool $isCheckVertex Check if the point sits exactly on one of the vertices? Default is false.

@return boolean true if the coordinate is inside polygon
425875
public function containsCoordinate(LatLng $coord, $isCheckVertex = false)
    {
        // Check if the point sits exactly on a vertex
        if ($isCheckVertex == true && $this->isOnVertexOfPolygon($coord) == true) {
            return true; // vertex
        }

        // Check if the point is inside the polygon or on the boundary
        $intersections = 0;
        $paths = ArrayHelper::getValue($this->options, 'paths');
        $vertexCount = count($paths);

        for ($i = 1; $i < $vertexCount; $i++) {
            $vertex1 = $paths[$i - 1];
            $vertex2 = $paths[$i];

            // Check if point is on a latitude polygon boundary
            if ($vertex1->lat == $vertex2->lat &&
                $vertex1->lat == $coord->lat &&
                $coord->lng > min($vertex1->lng, $vertex2->lng) &&
                $coord->lng < max($vertex1->lng, $vertex2->lng)
            ) {
                return true; // boundary
            }

            // Check if point is on a longitude polygon boundary
            if ($coord->lat > min($vertex1->lat, $vertex2->lat) &&
                $coord->lat <= max($vertex1->lat, $vertex2->lat) &&
                $coord->lng <= max($vertex1->lng, $vertex2->lng) &&
                $vertex1->lat != $vertex2->lat
            ) {
                $xinters = $coord->lat - $vertex1->lat;
                $xinters = $xinters * ($vertex2->lng - $vertex1->lng);
                $xinters = $xinters / ($vertex2->lat - $vertex1->lat);
                $xinters = $xinters + $vertex1->lng;

                if ($xinters == $coord->lng) {
                    return true; // boundary
                }
                if ($vertex1->lng == $vertex2->lng || $coord->lng <= $xinters) {
                    $intersections++;
                }
            }
        }

        // If the number of edges we passed through is odd, then it's in the polygon.
        if ($intersections % 2 != 0) {
            return true; // inside
        }
        return false; // outside
    }
406189
static <T> GraphTraversal<T, Vertex> isVertex(GraphTraversal<T, ? extends Element> traversal) {
        // This cast is safe because we filter only to vertices
        //noinspection unchecked
        return (GraphTraversal<T, Vertex>) traversal.filter(e -> e.get() instanceof Vertex);
    }
649657
function parseCoordinates(coord) {
    if (Array.isArray(coord) && coord.length === 2) {
        return {
            lng: coord[0],
            lat: coord[1],
        };
    }

    if (coord instanceof Object && coord !== null) {
        return {
            lng: coord.lng || coord.lon,
            lat: coord.lat,
        };
    }

    return {};
}
1279697
function (coords) {
      if (!selection.isSelected()) {
        return false;
      }
      var sel = grid.getCornerCoords([priv.selStart, priv.selEnd]);
      return (sel.TL.row <= coords.row && sel.BR.row >= coords.row && sel.TL.col <= coords.col && sel.BR.col >= coords.col);
    }
10912
def contains?( check_point )
      Util3D.check_arg_type(Vector3, check_point )
      plane = Plane.new( vertices[0], self.normal)
      distance, projected_point = plane.distance(check_point)
      return false if( distance > self.tolerance )
      g_coord = self.barycentric_coordinate(check_point)
      g_coord.each do |item|
        return false if( item < 0 or 1 < item)
      end
      return true
    end
73763
private static boolean polygonOverlapsPolygon_(Polygon polygon_a,
			Polygon polygon_b, double tolerance,
			ProgressTracker progress_tracker) {
		// Quick rasterize test to see whether the the geometries are disjoint,
		// or if one is contained in the other.
		int relation = tryRasterizedContainsOrDisjoint_(polygon_a, polygon_b,
				tolerance, false);

		if (relation == Relation.disjoint || relation == Relation.contains
				|| relation == Relation.within)
			return false;

		return polygonOverlapsPolygonImpl_(polygon_a, polygon_b, tolerance,
				progress_tracker);
	}
268973
public function isEqual(Coordinate $coordinate) {
        return bccomp($this->latitude, $coordinate->getLatitude(), $this->getPrecision()) === 0 && bccomp($this->longitude, $coordinate->getLongitude(), $this->getPrecision()) === 0;
    }
65149
public void fillPolygon(double[]... coord) {
        int[][] c = new int[coord.length][2];
        for (int i = 0; i < coord.length; i++) {
            c[i] = projection.screenProjection(coord[i]);
        }

        int[] x = new int[c.length];
        for (int i = 0; i < c.length; i++) {
            x[i] = c[i][0];
        }
        int[] y = new int[c.length];
        for (int i = 0; i < c.length; i++) {
            y[i] = c[i][1];
        }

        g2d.fillPolygon(x, y, c.length);
    }
1327554
static boolean polygonRelatePolygon_(Polygon polygon_a, Polygon polygon_b,
			double tolerance, String scl, ProgressTracker progress_tracker) {
		RelationalOperationsMatrix relOps = new RelationalOperationsMatrix();
		relOps.resetMatrix_();
		relOps.setPredicates_(scl);
		relOps.setAreaAreaPredicates_();

		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		polygon_a.queryEnvelope2D(env_a);
		polygon_b.queryEnvelope2D(env_b);

		boolean bRelationKnown = false;
		boolean b_disjoint = RelationalOperations.envelopeDisjointEnvelope_(
				env_a, env_b, tolerance, progress_tracker);

		if (b_disjoint) {
			relOps.areaAreaDisjointPredicates_(polygon_a, polygon_b);
			bRelationKnown = true;
		}

		if (!bRelationKnown) {
			// Quick rasterize test to see whether the the geometries are
			// disjoint, or if one is contained in the other.
			int relation = RelationalOperations
					.tryRasterizedContainsOrDisjoint_(polygon_a, polygon_b,
							tolerance, false);

			if (relation == RelationalOperations.Relation.disjoint) {
				relOps.areaAreaDisjointPredicates_(polygon_a, polygon_b);
				bRelationKnown = true;
			} else if (relation == RelationalOperations.Relation.contains) {
				relOps.areaAreaContainsPredicates_(polygon_b);
				bRelationKnown = true;
			} else if (relation == RelationalOperations.Relation.within) {
				relOps.areaAreaWithinPredicates_(polygon_a);
				bRelationKnown = true;
			}
		}

		if (!bRelationKnown) {
			EditShape edit_shape = new EditShape();
			int geom_a = edit_shape.addGeometry(polygon_a);
			int geom_b = edit_shape.addGeometry(polygon_b);
			relOps.setEditShapeCrackAndCluster_(edit_shape, tolerance,
					progress_tracker);
			relOps.computeMatrixTopoGraphHalfEdges_(geom_a, geom_b);
			relOps.m_topo_graph.removeShape();
		}

		boolean bRelation = relationCompare_(relOps.m_matrix, relOps.m_scl);
		return bRelation;
	}
289315
public boolean isChildOf(GeometryIndex parentIndex, GeometryIndex childIndex) {
		if (parentIndex.getValue() != childIndex.getValue()) {
			return false;
		}
		if (parentIndex.hasChild() && childIndex.hasChild()) {
			return isChildOf(parentIndex.getChild(), childIndex.getChild());
		} else if (!parentIndex.hasChild() && childIndex.hasChild()) {
			return true;
		}
		return false;
	}
509611
public boolean isRectangular () {
        return (_isPolygonal) && (_rulesSize <= 5) && (_coordsSize <= 8) &&
            (_coords[1] == _coords[3]) && (_coords[7] == _coords[5]) &&
            (_coords[0] == _coords[6]) && (_coords[2] == _coords[4]);
    }
1117861
public boolean isCorrect() {

        for (int n = 0; n < size; n++) {
            INDArray point = data.slice(index[n]);
            if (!boundary.containsPoint(point))
                return false;
        }

        return isLeaf() || northWest.isCorrect() && northEast.isCorrect() && southWest.isCorrect()
                        && southEast.isCorrect();

    }
218093
@Override
    public boolean doesCoordinateOverlapWithCommittedCoordinate(Coordinate coordinate) {
        return fixedRows.get(coordinate.row) || fixedVertices.contains(coordinate.match.vertex);
    }
766379
public static boolean contains(LatLong[] latLongs, LatLong latLong) {
        boolean result = false;
        for (int i = 0, j = latLongs.length - 1; i < latLongs.length; j = i++) {
            if ((latLongs[i].latitude > latLong.latitude) != (latLongs[j].latitude > latLong.latitude)
                    && (latLong.longitude < (latLongs[j].longitude - latLongs[i].longitude) * (latLong.latitude - latLongs[i].latitude)
                    / (latLongs[j].latitude - latLongs[i].latitude) + latLongs[i].longitude)) {
                result = !result;
            }
        }
        return result;
    }
631889
function isSea(lat, lng) {
  if (landLookup === null) {
    const map = getMap();
    landLookup = new GeoJsonLookup(map);
  }

  return landLookup.hasContainers({type: 'Point', coordinates: [lng, lat]});
}
936262
function polygonMakeCCW(polygon){
    var br = 0,
        v = polygon;

    // find bottom right point
    for (var i = 1; i < polygon.length; ++i) {
        if (v[i][1] < v[br][1] || (v[i][1] === v[br][1] && v[i][0] > v[br][0])) {
            br = i;
        }
    }

    // reverse poly if clockwise
    if (!isLeft(polygonAt(polygon, br - 1), polygonAt(polygon, br), polygonAt(polygon, br + 1))) {
        polygonReverse(polygon);
        return true;
    } else {
        return false;
    }
}
91935
static boolean polygonRelatePoint_(Polygon polygon_a, Point point_b,
			double tolerance, String scl, ProgressTracker progress_tracker) {
        RelationalOperationsMatrix relOps = new RelationalOperationsMatrix();
        relOps.resetMatrix_();
        relOps.setPredicates_(scl);
        relOps.setAreaPointPredicates_();

        Envelope2D env_a = new Envelope2D();
        polygon_a.queryEnvelope2D(env_a);
        Point2D pt_b = point_b.getXY();

        boolean bRelationKnown = false;
        boolean b_disjoint = RelationalOperations.pointDisjointEnvelope_(pt_b, env_a, tolerance, progress_tracker);

        if (b_disjoint)
        {
            relOps.areaPointDisjointPredicates_(polygon_a);
            bRelationKnown = true;
        }

        if (!bRelationKnown)
        {
            PolygonUtils.PiPResult res = PolygonUtils.isPointInPolygon2D(polygon_a, pt_b, tolerance); // uses accelerator

            if (res == PolygonUtils.PiPResult.PiPInside)
            {// polygon must have area
                relOps.m_matrix[MatrixPredicate.InteriorInterior] = 0;
                relOps.m_matrix[MatrixPredicate.InteriorExterior] = 2;
                relOps.m_matrix[MatrixPredicate.BoundaryInterior] = -1;
                relOps.m_matrix[MatrixPredicate.BoundaryExterior] = 1;
                relOps.m_matrix[MatrixPredicate.ExteriorInterior] = -1;
            }
            else if (res == PolygonUtils.PiPResult.PiPBoundary)
            {
                relOps.m_matrix[MatrixPredicate.ExteriorInterior] = -1;

                double area = polygon_a.calculateArea2D();

                if (area != 0)
                {
                    relOps.m_matrix[MatrixPredicate.InteriorInterior] = -1;
                    relOps.m_matrix[MatrixPredicate.BoundaryInterior] = 0;
                    relOps.m_matrix[MatrixPredicate.InteriorExterior] = 2;
                    relOps.m_matrix[MatrixPredicate.BoundaryExterior] = 1;
                }
                else
                {
                    relOps.m_matrix[MatrixPredicate.InteriorInterior] = 0;
                    relOps.m_matrix[MatrixPredicate.BoundaryInterior] = -1;
                    relOps.m_matrix[MatrixPredicate.BoundaryExterior] = -1;

                    Envelope2D env = new Envelope2D();
                    polygon_a.queryEnvelope2D(env);
                    relOps.m_matrix[MatrixPredicate.InteriorExterior] = (env.getHeight() == 0.0 && env.getWidth() == 0.0 ? -1 : 1);
                }
            }
            else
            {
                relOps.areaPointDisjointPredicates_(polygon_a);
            }
        }

        boolean bRelation = relationCompare_(relOps.m_matrix, scl);
        return bRelation;
	}