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

27 lines
639 B
Python

from Shape import Shape
class Line(Shape):
def __init__(self, x0, y0, x1, 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])
elif ptNum == 2:
return ([0.5, 0, 0.5, 0], [0, 0.5, 0, 0.5])
def getPt(self, ptNum):
if ptNum == 0:
return (self.vars[0], self.vars[1])
elif ptNum == 1:
return (self.vars[2], self.vars[3])