MCPcopy Create free account
hub / github.com/tdewolff/canvas / ContainsPoint

Method ContainsPoint

path.go:949–955  ·  view source on GitHub ↗

Contains returns whether the point (x,y) is contained/filled by the path. This depends on the FillRule. It uses a ray from (x,y) toward (∞,y) and counts the number of intersections with the path. When the point is on the boundary it is considered to be on the path's exterior.

(x, y float64, fillRule FillRule)

Source from the content-addressed store, hash-verified

947// FillRule. It uses a ray from (x,y) toward (∞,y) and counts the number of intersections with
948// the path. When the point is on the boundary it is considered to be on the path's exterior.
949func (p *Path) ContainsPoint(x, y float64, fillRule FillRule) bool {
950 n, boundary := p.WindingsAt(x, y)
951 if boundary {
952 return true
953 }
954 return fillRule.Fills(n)
955}
956
957// CCW returns true when the path is counter clockwise oriented at its right-most coordinate
958// (bottom-most of all right-most coordinates). It is most useful when knowing that the path does

Callers

nothing calls this directly

Calls 2

WindingsAtMethod · 0.95
FillsMethod · 0.80

Tested by

no test coverage detected