CubeTo adds a cubic Bézier path with control points (cpx1,cpy1) and (cpx2,cpy2) and end point (x,y).
(cpx1, cpy1, cpx2, cpy2, x, y float64)
| 471 | |
| 472 | // CubeTo adds a cubic Bézier path with control points (cpx1,cpy1) and (cpx2,cpy2) and end point (x,y). |
| 473 | func (p *Path) CubeTo(cpx1, cpy1, cpx2, cpy2, x, y float64) { |
| 474 | start := p.Pos() |
| 475 | cp1 := Point{cpx1, cpy1} |
| 476 | cp2 := Point{cpx2, cpy2} |
| 477 | end := Point{x, y} |
| 478 | if start.Equals(end) && start.Equals(cp1) && start.Equals(cp2) { |
| 479 | return |
| 480 | } else if !start.Equals(end) && (start.Equals(cp1) || end.Equals(cp1) || angleEqual(end.Sub(start).AngleBetween(cp1.Sub(start)), 0.0) && angleEqual(end.Sub(start).AngleBetween(end.Sub(cp1)), 0.0)) && (start.Equals(cp2) || end.Equals(cp2) || angleEqual(end.Sub(start).AngleBetween(cp2.Sub(start)), 0.0) && angleEqual(end.Sub(start).AngleBetween(end.Sub(cp2)), 0.0)) { |
| 481 | p.LineTo(end.X, end.Y) |
| 482 | return |
| 483 | } |
| 484 | |
| 485 | if len(p.d) == 0 { |
| 486 | p.MoveTo(0.0, 0.0) |
| 487 | } else if p.d[len(p.d)-1] == CloseCmd { |
| 488 | p.MoveTo(p.d[len(p.d)-3], p.d[len(p.d)-2]) |
| 489 | } |
| 490 | p.d = append(p.d, CubeToCmd, cp1.X, cp1.Y, cp2.X, cp2.Y, end.X, end.Y, CubeToCmd) |
| 491 | } |
| 492 | |
| 493 | // ArcTo adds an arc with radii rx and ry, with rot the counter clockwise rotation with respect to the coordinate system in degrees, large and sweep booleans (see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#Arcs), and (x,y) the end position of the pen. The start position of the pen was given by a previous command's end point. |
| 494 | func (p *Path) ArcTo(rx, ry, rot float64, large, sweep bool, x, y float64) { |
no test coverage detected