fixed a bug with anticlockwise arcs
This commit is contained in:
parent
e5bdee1d67
commit
9b5004d6b9
1 changed files with 10 additions and 3 deletions
13
paths.go
13
paths.go
|
@ -95,9 +95,16 @@ func (cv *Canvas) Arc(x, y, radius, startAngle, endAngle float32, anticlockwise
|
||||||
if step > 0.8 {
|
if step > 0.8 {
|
||||||
step = 0.8
|
step = 0.8
|
||||||
}
|
}
|
||||||
for a := startAngle; a < endAngle; a += step {
|
if anticlockwise {
|
||||||
s, c := fmath.Sincos(a)
|
for a := startAngle; a > endAngle; a -= step {
|
||||||
cv.LineTo(x+radius*c, y+radius*s)
|
s, c := fmath.Sincos(a)
|
||||||
|
cv.LineTo(x+radius*c, y+radius*s)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for a := startAngle; a < endAngle; a += step {
|
||||||
|
s, c := fmath.Sincos(a)
|
||||||
|
cv.LineTo(x+radius*c, y+radius*s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s, c := fmath.Sincos(endAngle)
|
s, c := fmath.Sincos(endAngle)
|
||||||
cv.LineTo(x+radius*c, y+radius*s)
|
cv.LineTo(x+radius*c, y+radius*s)
|
||||||
|
|
Loading…
Reference in a new issue