Exemplo n.º 1
0
    def __dxftags__(self):
        def curve_point(alpha):
            alpha = radians(alpha)
            point = (cos(alpha) * self.rx,
                     sin(alpha) * self.ry)
            point = rotate_2d(point, radians(self.rotation))
            x, y = vadd(self.center, point)
            return (x, y, zaxis)

        def normalize_angle(angle):
            angle = fmod(angle, 360.)
            if angle < 0:
                angle += 360.
            return angle

        zaxis = 0. if len(self.center)<3 else self.center[2]
        points = []
        delta = (self.endangle - self.startangle) / self.segments
        for segment in xrange(self.segments):
            alpha = self.startangle + delta * segment
            points.append(curve_point(alpha))
        polyline = Polyline(points, color=self.color, layer=self.layer,
                            linetype=self.linetype)

        if equals_almost(self.startangle, normalize_angle(self.endangle)):
            polyline.close()
        return polyline.__dxftags__()
Exemplo n.º 2
0
 def __dxftags__(self):
     spline = CubicSpline(self.points)
     polyline = Polyline(spline.approximate(self.segments),
                         layer = self.layer,
                         color=self.color,
                         linetype = self.linetype)
     return polyline.__dxftags__()
Exemplo n.º 3
0
 def __dxftags__(self):
     polyline = Polyline(layer=self.layer, color=self.color,
                         linetype=self.linetype)
     for segment in self._build_bezier_segments():
         points = segment.approximate()
         polyline.add_vertices(points)
     return polyline.__dxftags__()
Exemplo n.º 4
0
Arquivo: curves.py Projeto: msarch/py
    def __dxftags__(self):
        def curve_point(alpha):
            alpha = radians(alpha)
            point = (cos(alpha) * self.rx, sin(alpha) * self.ry)
            point = rotate_2d(point, radians(self.rotation))
            x, y = vadd(self.center, point)
            return (x, y, zaxis)

        def normalize_angle(angle):
            angle = fmod(angle, 360.)
            if angle < 0:
                angle += 360.
            return angle

        zaxis = 0. if len(self.center) < 3 else self.center[2]
        points = []
        delta = (self.endangle - self.startangle) / self.segments
        for segment in xrange(self.segments):
            alpha = self.startangle + delta * segment
            points.append(curve_point(alpha))
        polyline = Polyline(points,
                            color=self.color,
                            layer=self.layer,
                            linetype=self.linetype)

        if equals_almost(self.startangle, normalize_angle(self.endangle)):
            polyline.close()
        return polyline.__dxftags__()
Exemplo n.º 5
0
Arquivo: curves.py Projeto: msarch/py
 def __dxftags__(self):
     spline = CubicSpline(self.points)
     polyline = Polyline(spline.approximate(self.segments),
                         layer=self.layer,
                         color=self.color,
                         linetype=self.linetype)
     return polyline.__dxftags__()
Exemplo n.º 6
0
Arquivo: curves.py Projeto: msarch/py
 def __dxftags__(self):
     polyline = Polyline(layer=self.layer,
                         color=self.color,
                         linetype=self.linetype)
     for segment in self._build_bezier_segments():
         points = segment.approximate()
         polyline.add_vertices(points)
     return polyline.__dxftags__()