Point.in_polygon
- Point.in_polygon(polygon, convex=None)[source]
Determine if the point lies inside the given polygon.
- Parameters
polygon (sequence[point] |
compas.geometry.Polygon
) – The polygon.convex (Literal[None, True, False], optional) – If None, determine if the polygon is convex. If False, use the non-convex algorithm. If True, use the convex algorithm.
- Returns
bool – True, if the point lies in the polygon. False, otherwise.
Examples
>>> from compas.geometry import Polygon >>> poly = Polygon([Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0), Point(0.0, 1.0, 0.0)]) >>> point = Point(0.5, 0.5, 0.0) >>> point.in_polygon(poly) True