From da1c47441ec0aa89d6482ac19dc98fdb72d30761 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 25 Mar 2011 15:42:12 -0400 Subject: [PATCH] add classes for constraints --- Constraint.py | 3 +++ DistanceConstraint.py | 10 ++++++++++ EqualConstraint.py | 9 +++++++++ Sketch.py | 1 + 4 files changed, 23 insertions(+) create mode 100644 Constraint.py create mode 100644 DistanceConstraint.py create mode 100644 EqualConstraint.py diff --git a/Constraint.py b/Constraint.py new file mode 100644 index 0000000..92eed8d --- /dev/null +++ b/Constraint.py @@ -0,0 +1,3 @@ + +class Constraint(object): + pass diff --git a/DistanceConstraint.py b/DistanceConstraint.py new file mode 100644 index 0000000..3854d6e --- /dev/null +++ b/DistanceConstraint.py @@ -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 diff --git a/EqualConstraint.py b/EqualConstraint.py new file mode 100644 index 0000000..1e4dc3e --- /dev/null +++ b/EqualConstraint.py @@ -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 diff --git a/Sketch.py b/Sketch.py index 5a83494..ce5b57a 100644 --- a/Sketch.py +++ b/Sketch.py @@ -2,6 +2,7 @@ class Sketch(object): def __init__(self): self.shapes = [] + self.constraints = [] def __iter__(self): return self.shapes.__iter__()