split Fix into XFix/YFix constraints

This commit is contained in:
Josh Holtrop 2011-03-30 15:51:45 -04:00
parent 5dd89c2cc9
commit 2200460b56
2 changed files with 16 additions and 1 deletions

View File

@ -1,7 +1,7 @@
from Constraint import Constraint
class Fix(Constraint):
class XFix(Constraint):
def __init__(self, shape, pt, val):
self.shape = shape
self.pt = pt

15
YFix.py Normal file
View File

@ -0,0 +1,15 @@
from Constraint import Constraint
class YFix(Constraint):
def __init__(self, shape, pt, val):
self.shape = shape
self.pt = pt
self.val = val
def toEqu(self):
varrefs1 = self.shape.toEqu(self.pt)[1]
coeffs = []
for i in range(len(varrefs1)):
coeffs.append((varrefs1[i], (self.shape, i)))
return [(coeffs, -self.val)]