Example #1
0
 def connect(cls, path1, path2):
     """Connect two paths to form a new path."""
     ns = StraightLine.from_points(path1.end, path2.start)
     np = Path()
     np.segments.extend(path1.segments)
     np.append(ns)
     np.segments.extend(path2.segments)
     np.start = path1.start
     np.end = path2.end
     return np
Example #2
0
 def close(self):
     """Close the path by connecting 'start' and 'end' with a straight line, 
        then point self.end to the same thing as self.start pointed to."""
     #if self.closed:
     #    print "No sense to close an already closed path"
     #else:
     if self.end.x != self.start.x or self.end.y != self.start.y:
         close_seg = StraightLine.from_points(self.end, self.start)
         self.segments.append(close_seg)
     self.end = self.start
     self.closed = True