add classes for constraints

This commit is contained in:
Josh Holtrop 2011-03-25 15:42:12 -04:00
parent 36c6f092fd
commit da1c47441e
4 changed files with 23 additions and 0 deletions

3
Constraint.py Normal file
View File

@ -0,0 +1,3 @@
class Constraint(object):
pass

10
DistanceConstraint.py Normal file
View File

@ -0,0 +1,10 @@
from Constraint import Constraint
class DistanceConstraint(Constraint):
def __init__(self, shape1, attr1, shape2, attr2, dist):
self.shape1 = shape1
self.shape2 = shape2
self.attr1 = attr1
self.attr2 = attr2
self.dist = dist

9
EqualConstraint.py Normal file
View File

@ -0,0 +1,9 @@
from Constraint import Constraint
class EqualConstraint(Constraint):
def __init__(self, shape1, attr1, shape2, attr2):
self.shape1 = shape1
self.shape2 = shape2
self.attr1 = attr1
self.attr2 = attr2

View File

@ -2,6 +2,7 @@
class Sketch(object):
def __init__(self):
self.shapes = []
self.constraints = []
def __iter__(self):
return self.shapes.__iter__()