MCPcopy
hub / github.com/tdewolff/canvas / Xor

Method Xor

path_intersection.go:181–183  ·  view source on GitHub ↗

Xor returns the boolean path operation of path p XOR q, i.e. the symmetric difference of both. It removes all self-intersections and overlapping areas, orients all filling paths CCW and all holes CW, and tries to separate paths as much as possible. Paths are grouped by the filling/outer ring followe

(q *Path)

Source from the content-addressed store, hash-verified

179// flat. Path q is implicitly closed. It runs in O((n + k) log n), with n the number of segments,
180// and k the number of intersections.
181func (p *Path) Xor(q *Path) *Path {
182 return bentleyOttmann(p.Split(), q.Split(), opXOR, NonZero).Merge()
183}
184
185// Xor is the same as Path.Xor, but faster if paths are already split. Each resulting path
186// is a single filling path followed by its holes as subpaths.

Callers 5

DrawPreviewWithAssetsFunction · 0.45
TestPathXorFunction · 0.45
drawFunction · 0.45
draw2Function · 0.45
drawFunction · 0.45

Calls 3

SplitMethod · 0.95
bentleyOttmannFunction · 0.85
MergeMethod · 0.80

Tested by 1

TestPathXorFunction · 0.36