vector: change the specificatino of Path.ArcTo

Closes #2401
This commit is contained in:
Hajime Hoshi 2022-10-22 02:01:58 +09:00
parent 5e15bafde8
commit c34c072efa
2 changed files with 3 additions and 4 deletions

View File

@ -212,6 +212,7 @@ func drawArc(screen *ebiten.Image, count int, aa bool, line bool) {
x := cx + r*math.Cos(theta1)
y := cy + r*math.Sin(theta1)
path.ArcTo(450, 100, float32(x), float32(y), 30)
path.LineTo(float32(x), float32(y))
theta2 := math.Pi * float64(count) / 180 / 3
path.MoveTo(550, 100)

View File

@ -248,7 +248,8 @@ func cross(p0, p1 point) float32 {
return p0.x*p1.y - p1.x*p0.y
}
// ArcTo adds an arc curve to the path. (x1, y1) is the control point, and (x2, y2) is the destination.
// ArcTo adds an arc curve to the path.
// (x1, y1) is the first control point, and (x2, y2) is the second control point.
func (p *Path) ArcTo(x1, y1, x2, y2, radius float32) {
p0, ok := p.currentPosition()
if !ok {
@ -264,7 +265,6 @@ func (p *Path) ArcTo(x1, y1, x2, y2, radius float32) {
}
if d0 == (point{}) || d1 == (point{}) {
p.LineTo(x1, y1)
p.LineTo(x2, y2)
return
}
@ -300,8 +300,6 @@ func (p *Path) ArcTo(x1, y1, x2, y2, radius float32) {
dir = Clockwise
}
p.Arc(cx, cy, radius, a0, a1, dir)
p.LineTo(x2, y2)
}
// Arc adds an arc to the path.