region2.contains
Whether a point lies inside an outline of the region and in none of that outline’s holes.
Usage
region.contains(p: Point2): booleanParameters
pPoint2The point to test. Required. In model.
Returns
true inside the region; false outside, in a hole, for Region2.empty and for a non-finite point.
Guarantees
- true exactly when some part’s outer.contains(p) and none of its holes contains p (nonZero per ring)
- The same result on every machine.
Example
const r = Region2.of(Polygon2.rectangle(4, 4).value, [Polygon2.rectangle(2, 2).value])
r.contains(Point2.of(1.5, 0)) && !r.contains(Point2.origin) // → true (in the ring, not in the hole)