add vars array to Line and Circle for solver
This commit is contained in:
1 parent
4932447df9
commit
cc3831e235
2 files changed
+33
-5
No files matched your search
@@ -1,3 +1,22 @@
|
||||
|
||||
class Circle(Shape):
|
||||
pass
|
||||
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])
|
||||
@@ -1,7 +1,16 @@
|
||||
|
||||
class Line(Shape):
|
||||
def __init__(self, x0, y0, x1, y1):
|
||||
self.x0 = x0
|
||||
self.y0 = y0
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.vars = [x0, y0, x1, y1]
|
||||
|
||||
def nVars(self):
|
||||
return len(self.vars)
|
||||
|
||||
def nPts(self):
|
||||
return 3
|
||||
|
||||
def toEqu(self, ptNum):
|
||||
if ptNum == 0:
|
||||
return ([1, 0, 0, 0], [0, 1, 0, 0])
|
||||
elif ptNum == 1:
|
||||
return ([0, 0, 1, 0], [0, 0, 0, 1])
|
||||
Reference in new issue
Block a user