filled out Horizontal and Vertical toEqu() methods

This commit is contained in:
Josh Holtrop 2011-03-28 18:10:49 -04:00
parent c8d2f9a82a
commit c13fc5ad93
2 changed files with 20 additions and 0 deletions

View File

@ -7,3 +7,13 @@ class Horizontal(Constraint):
self.pt1 = pt1
self.shape2 = shape2
self.pt2 = pt2
def toEqu(self):
varrefs1 = self.shape1.toEqu(pt1)[1]
varrefs2 = self.shape2.toEqu(pt2)[1]
coeffs = []
for i in range(len(varrefs1)):
coeffs.append((1 * varrefs1[i], (self.shape1, i)))
for i in range(len(varrefs2)):
coeffs.append((-1 * varrefs2[i], (self.shape2, i))
return [(coeffs, 0)]

View File

@ -7,3 +7,13 @@ class Vertical(Constraint):
self.pt1 = pt1
self.shape2 = shape2
self.pt2 = pt2
def toEqu(self):
varrefs1 = self.shape1.toEqu(pt1)[0]
varrefs2 = self.shape2.toEqu(pt2)[0]
coeffs = []
for i in range(len(varrefs1)):
coeffs.append((1 * varrefs1[i], (self.shape1, i)))
for i in range(len(varrefs2)):
coeffs.append((-1 * varrefs2[i], (self.shape2, i))
return [(coeffs, 0)]