From 5dd89c2cc9b8462ceea398566c018afb428dc616 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 30 Mar 2011 15:48:27 -0400 Subject: [PATCH] add Fix constraint to fix a coordinate to a value --- Fix.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Fix.py diff --git a/Fix.py b/Fix.py new file mode 100644 index 0000000..56d4690 --- /dev/null +++ b/Fix.py @@ -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)]