z = isInsidePolygon (point, polygon, eps);
Determines whether point is inside polygon.
point is given by its x and y coordinates.
polygon is given by a vector of points, each point being given by its x and y coordinates.
If point is inside polygon, then z > + 0.5. If point is outside polygon, then - 0.5 < z < + 0.5. If it cannot be decided whether point is inside or outside polygon, then z < - 0.5.
The result is undecided when point is too close to polygon, the tolerance being given by eps. The default is eps = 1e-4.
z = isInsidePolygon
({-23, -7},
{{-92,-4},{-64,24},{-60,-14},{-42,24},{-24,-34},{60,-44},{2,8},{44,18},{8,84},{-74,82}});
returns z > 0.5; (cf. graphics in diagram layer)
function isInsidePolygon input Real point[2] "Point"; input Real polygon[:, 2] "Polygon"; input Real tolerance = 0 "Tolerance"; output Real insidePolygon "> 0.5: point is inside polygon. > -0.5 and < 0.5: point is outside polygon: < -0.5: undecided"; end isInsidePolygon;