From c34c072efadcbc9e7aae71ba0ffe7848a0f4326d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 22 Oct 2022 02:01:58 +0900 Subject: [PATCH] vector: change the specificatino of Path.ArcTo Closes #2401 --- examples/vector/main.go | 1 + vector/path.go | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/vector/main.go b/examples/vector/main.go index c71f54702..c883c918a 100644 --- a/examples/vector/main.go +++ b/examples/vector/main.go @@ -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) diff --git a/vector/path.go b/vector/path.go index 610e11a08..fa1a366d3 100644 --- a/vector/path.go +++ b/vector/path.go @@ -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.