Fix the wrong path calculation of Arc with small angle

This commit is contained in:
tomfisher
2015-02-04 16:11:57 +08:00
parent bfb6709b1b
commit bcba265386
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -283,7 +283,7 @@ public abstract class AbstractArc extends RectangularShape implements IArc
k = -k; k = -k;
} }
} else { } else {
arcCount = (int)Math.rint(Math.abs(extent) / 90f); arcCount = MathUtil.iceil(Math.abs(extent) / 90f);
step = Math.toRadians(extent / arcCount); step = Math.toRadians(extent / arcCount);
k = 4f / 3f * (1f - Math.cos(step / 2f)) / Math.sin(step / 2f); k = 4f / 3f * (1f - Math.cos(step / 2f)) / Math.sin(step / 2f);
} }
+1 -1
View File
@@ -283,7 +283,7 @@ public abstract class AbstractArc extends RectangularShape implements IArc
k = -k; k = -k;
} }
} else { } else {
arcCount = (int)Math.rint(Math.abs(extent) / 90f); arcCount = MathUtil.iceil(Math.abs(extent) / 90f);
step = FloatMath.toRadians(extent / arcCount); step = FloatMath.toRadians(extent / arcCount);
k = 4f / 3f * (1f - FloatMath.cos(step / 2f)) / FloatMath.sin(step / 2f); k = 4f / 3f * (1f - FloatMath.cos(step / 2f)) / FloatMath.sin(step / 2f);
} }