polygon2.contains
Whether the ring encloses a point under a fill rule.
Usage
polygon.contains(p: Point2, fillRule?: FillRule): booleanParameters
pPoint2The point to test. Required. In model.
fillRuleFillRuleWhich points a ring encloses: winding number ≠ 0, or an odd number of crossings. Default
'nonZero'. One ofnonZero,evenOdd.
Returns
true when the winding number is non-zero (nonZero) or odd (evenOdd); false outside and for a non-finite point.
Guarantees
- agrees with windingNumber(p): w !== 0 for nonZero, w % 2 !== 0 for evenOdd
- The same result on every machine.
Example
Polygon2.rectangle(2, 2).value.contains(Point2.of(0.5, 0.5)) // → true