Coords returns all the coordinates of the segment start/end points. It omits zero-length CloseCmds.
()
| 384 | |
| 385 | // Coords returns all the coordinates of the segment start/end points. It omits zero-length CloseCmds. |
| 386 | func (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 |