jpcad/Circle.py
2011-04-01 09:59:44 -04:00

31 lines
688 B
Python

from Shape import Shape
class Circle(Shape):
def __init__(self, x, y, r):
self.vars = [x, y, r]
def nVars(self):
return len(self.vars)
def nPts(self):
return 5
def toEqu(self, ptNum):
if ptNum == 0:
return ([1, 0, 0], [0, 1, 0])
elif ptNum == 1:
return ([1, 0, 1], [0, 1, 0])
elif ptNum == 2:
return ([1, 0, 0], [0, 1, 1])
elif ptNum == 3:
return ([1, 0, -1], [0, 1, 0])
elif ptNum == 4:
return ([1, 0, 0], [0, 1, -1])
def getCenter(self):
return (self.vars[0], self.vars[1])
def getRadius(self):
return self.vars[2]