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

Method Merge

path.go:115–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113}
114
115func (ps Paths) Merge() *Path {
116 n := 0
117 for _, pi := range ps {
118 n += pi.Len()
119 }
120 p := &Path{d: make([]float64, 0, n)}
121 for _, pi := range ps {
122 p = p.Append(pi)
123 }
124 return p
125}
126
127// Path defines a vector path in 2D using a series of commands (MoveTo, LineTo, QuadTo, CubeTo, ArcTo and Close). Each command consists of a number of float64 values (depending on the command) that fully define the action. The first value is the command itself (as a float64). The last two values is the end point position of the pen after the action (x,y). QuadTo defined one control point (x,y) in between, CubeTo defines two control points, and ArcTo defines (rx,ry,phi,large+sweep) i.e. the radius in x and y, its rotation (in radians) and the large and sweep booleans in one float64.
128// Only valid commands are appended, so that LineTo has a non-zero length, QuadTo's and CubeTo's control point(s) don't (both) overlap with the start and end point, and ArcTo has non-zero radii and has non-zero length. For ArcTo we also make sure the angle is in the range [0, 2*PI) and we scale the radii up if they appear too small to fit the arc.

Callers 8

SettleMethod · 0.80
AndMethod · 0.80
OrMethod · 0.80
XorMethod · 0.80
NotMethod · 0.80
DivMethod · 0.80

Calls 2

AppendMethod · 0.95
LenMethod · 0.45

Tested by 2