Exemple #1
0
 def updatenormpath(self, normpath, context):
     normpath.normsubpaths[-1].append(normcurve_pt(context.x_pt, context.y_pt,
                                                   self.x1_pt, self.y1_pt,
                                                   self.x2_pt, self.y2_pt,
                                                   self.x3_pt, self.y3_pt))
     context.x_pt = self.x3_pt
     context.y_pt = self.y3_pt
Exemple #2
0
 def updatenormpath(self, normpath, context):
     normpath.normsubpaths[-1].append(normcurve_pt(context.x_pt, context.y_pt,
                                                   context.x_pt + self.dx1_pt, context.y_pt + self.dy1_pt,
                                                   context.x_pt + self.dx2_pt, context.y_pt + self.dy2_pt,
                                                   context.x_pt + self.dx3_pt, context.y_pt + self.dy3_pt))
     context.x_pt += self.dx3_pt
     context.y_pt += self.dy3_pt
Exemple #3
0
 def updatenormpath(self, normpath, context):
     x0_pt, y0_pt = context.x_pt, context.y_pt
     for point_pt in self.points_pt:
         normpath.normsubpaths[-1].append(
             normcurve_pt(x0_pt, y0_pt, *point_pt))
         x0_pt, y0_pt = point_pt[4:]
     context.x_pt, context.y_pt = x0_pt, y0_pt
Exemple #4
0
def _arctobcurve(x_pt, y_pt, r_pt, phi1, phi2):
    """generate the best bezier curve corresponding to an arc segment"""

    dphi = phi2-phi1

    if dphi==0: return None

    # the two endpoints should be clear
    x0_pt, y0_pt = x_pt+r_pt*cos(phi1), y_pt+r_pt*sin(phi1)
    x3_pt, y3_pt = x_pt+r_pt*cos(phi2), y_pt+r_pt*sin(phi2)

    # optimal relative distance along tangent for second and third
    # control point
    l = r_pt*4*(1-cos(dphi/2))/(3*sin(dphi/2))

    x1_pt, y1_pt = x0_pt-l*sin(phi1), y0_pt+l*cos(phi1)
    x2_pt, y2_pt = x3_pt+l*sin(phi2), y3_pt-l*cos(phi2)

    return normcurve_pt(x0_pt, y0_pt, x1_pt, y1_pt, x2_pt, y2_pt, x3_pt, y3_pt)
Exemple #5
0
 def updatenormpath(self, normpath, context):
     x0_pt, y0_pt = context.x_pt, context.y_pt
     for point_pt in self.points_pt:
         normpath.normsubpaths[-1].append(normcurve_pt(x0_pt, y0_pt, *point_pt))
         x0_pt, y0_pt = point_pt[4:]
     context.x_pt, context.y_pt = x0_pt, y0_pt