add Fix constraint to fix a coordinate to a value

This commit is contained in:
Josh Holtrop 2011-03-30 15:48:27 -04:00
parent 9c2bb94603
commit 5dd89c2cc9

15
Fix.py Normal file
View File

@ -0,0 +1,15 @@
from Constraint import Constraint
class Fix(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)[0]
coeffs = []
for i in range(len(varrefs1)):
coeffs.append((varrefs1[i], (self.shape, i)))
return [(coeffs, -self.val)]