Flatten flattens all Bézier and arc curves into linear segments and returns a new path. It uses tolerance as the maximum deviation.
(tolerance float64)
| 1446 | |
| 1447 | // Flatten flattens all Bézier and arc curves into linear segments and returns a new path. It uses tolerance as the maximum deviation. |
| 1448 | func (p *Path) Flatten(tolerance float64) *Path { |
| 1449 | quad := func(p0, p1, p2 Point) *Path { |
| 1450 | return flattenQuadraticBezier(p0, p1, p2, tolerance) |
| 1451 | } |
| 1452 | cube := func(p0, p1, p2, p3 Point) *Path { |
| 1453 | return flattenCubicBezier(p0, p1, p2, p3, tolerance) |
| 1454 | } |
| 1455 | arc := func(start Point, rx, ry, phi float64, large, sweep bool, end Point) *Path { |
| 1456 | return flattenEllipticArc(start, rx, ry, phi, large, sweep, end, tolerance) |
| 1457 | } |
| 1458 | return p.replace(nil, quad, cube, arc) |
| 1459 | } |
| 1460 | |
| 1461 | // ReplaceArcs replaces ArcTo commands by CubeTo commands and returns a new path. |
| 1462 | func (p *Path) ReplaceArcs() *Path { |
no test coverage detected