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

Method Coords

path.go:386–396  ·  view source on GitHub ↗

Coords returns all the coordinates of the segment start/end points. It omits zero-length CloseCmds.

()

Source from the content-addressed store, hash-verified

384
385// Coords returns all the coordinates of the segment start/end points. It omits zero-length CloseCmds.
386func (p *Path) Coords() []Point {
387 coords := []Point{}
388 for i := 0; i < len(p.d); {
389 cmd := p.d[i]
390 i += cmdLen(cmd)
391 if len(coords) == 0 || cmd != CloseCmd || !coords[len(coords)-1].Equals(Point{p.d[i-3], p.d[i-2]}) {
392 coords = append(coords, Point{p.d[i-3], p.d[i-2]})
393 }
394 }
395 return coords
396}
397
398////////////////////////////////////////////////////////////////
399

Callers 4

simplifyToCoordsMethod · 0.95
MarkersMethod · 0.95
parseDefsMethod · 0.45
TestPathCoordsFunction · 0.45

Calls 2

cmdLenFunction · 0.85
EqualsMethod · 0.45

Tested by 1

TestPathCoordsFunction · 0.36