Skip to content

Commit

Permalink
Fix Arc and PieSlice for small radii
Browse files Browse the repository at this point in the history
  • Loading branch information
scotty007 committed Oct 28, 2020
1 parent 9e32f23 commit c46c9bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/libavg/geom.py
Expand Up @@ -135,7 +135,7 @@ def getCirclePoint(i):
circlePart = (self.__endangle - self.__startangle)/6.28
numPoints = self.__radius*2.*circlePart
if numPoints < 4:
numPoints = 4
numPoints = 4.0
for i in xrange(0, int(numPoints)):
pos.append(getCirclePoint(i/numPoints))
pos.append(getCirclePoint(1))
Expand Down Expand Up @@ -197,8 +197,9 @@ def getCirclePoint(i):
pos = []
circlePart = (self.__endangle - self.__startangle)/6.28
numPoints = self.__radius*2.*circlePart
if numPoints < 4:
numPoints = 4.0
for i in xrange(0, int(numPoints)):
pos.append(getCirclePoint(i/numPoints))
pos.append(getCirclePoint(1))
self.polyPos = pos

5 changes: 5 additions & 0 deletions src/test/PythonTest.py
Expand Up @@ -104,6 +104,9 @@ def changeAttrs():
self.arc.radius = 50
self.arc.pos = (80.5, 60.5)

def makeSmall():
self.arc.radius = 0.6

root = self.loadEmptyScene()
self.arc = geom.Arc(parent=root, pos=(20.5,20.5),
radius=40, startangle=0, endangle=1.57, color="FF0000")
Expand All @@ -112,6 +115,8 @@ def changeAttrs():
(lambda: self.compareImage("testArc1"),
changeAttrs,
lambda: self.compareImage("testArc2"),
makeSmall,
lambda: self.compareImage("testArc3"),
))

def btoa(self):
Expand Down
Binary file added src/test/baseline/testArc3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/test/baseline/testPieSlice3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c46c9bd

Please sign in to comment.