Beispiel #1
0
class RelativeVector(PathSegment):
    def __init__(self, x, y):
        self.point = Point(x,y)

    def specification(self):
        return 'l %s ' % self.point.format()

    def scale(self,scale):
        self.point= self.point.scale(scale)
        return self
Beispiel #2
0
 def transform(self, point):
     p = point
     s = sin(radians(-self.angle))
     c = cos(radians(-self.angle))
     point1 = Point(c * p.x + s * p.y, (c * p.y - s * p.x))
     result = point1
     return result
Beispiel #3
0
def horizontal_line(start,
                    length,
                    color='black',
                    stroke_width=1,
                    linecap='butt'):
    return Line(start,
                start + Point(length, 0),
                color=color,
                stroke_width=stroke_width,
                linecap=linecap)
Beispiel #4
0
 def __init__(self,
              width,
              height,
              stroke_width=1,
              stroke='black',
              stroke_dasharray=None,
              rounded=False,
              **attributes):
     SimpleItem.__init__(self, Point(0, 0))
     self.width = width
     self.height = height
     self.stroke_width = stroke_width
     self.stroke_dasharray = stroke_dasharray
     self.stroke = stroke
     self.rounded = rounded
     self._attributes = attributes
Beispiel #5
0
 def rotate(self, theta, origin=Point(0, 0)):
     self.transformations.append(Rotation(theta, origin))
     return self
Beispiel #6
0
 def move_center_to(self, point):
     self.move_to(point - Point(self.radius, self.radius))
     return self
Beispiel #7
0
 def center(self):
     return self.top_left + Point(self.radius, self.radius)
Beispiel #8
0
 def center(self):
     return self.top_left + Point(self.width, self.height).scale(0.5)
Beispiel #9
0
 def set_center(self, x, y):
     self.move_to(Point(x - 0.5 * self.width, y - 0.5 * self.height))
     return self
Beispiel #10
0
 def __init__(self, angle, origin=Point(0, 0)):
     self.angle = angle
     self.origin = origin
Beispiel #11
0
 def __init__(self, x, y):
     self.point = Point(x,y)