コード例 #1
0
def create_star_path(corners, outer_radius, inner_radius):
    outer_radius = unit.convert(outer_radius)
    inner_radius = unit.convert(inner_radius)
    path = CreatePath()
    angle = math.pi * 2 / corners
    for i in range(corners):
        path.AppendLine(Polar(outer_radius, angle * i))
        path.AppendLine(Polar(inner_radius, angle * i + angle / 2))
    path.AppendLine(path.Node(0))
    path.ClosePath()
    return path
コード例 #2
0
def create_star_path(corners, outer_radius, inner_radius):
    outer_radius = unit.convert(outer_radius)
    inner_radius = unit.convert(inner_radius)
    path = CreatePath()
    angle = math.pi * 2 / corners
    for i in range(corners):
        path.AppendLine(Polar(outer_radius, angle * i))
        path.AppendLine(Polar(inner_radius, angle * i + angle / 2))
    path.AppendLine(path.Node(0))
    path.ClosePath()
    return path
コード例 #3
0
def create_spiral_path(rotation, radius):
    r = unit.convert(radius)
    rate = r / (rotation * 2 * pi)

    def tangent(phi, a=0.55197 * rate):
        return a * Point(cos(phi) - phi * sin(phi), sin(phi) + phi * cos(phi))

    pi2 = pi / 2.0
    angle = 0
    tang = tangent(0)
    path = CreatePath()
    p = Point(0, 0)
    path.AppendLine(p)
    for i in range(rotation * 4):
        p1 = p + tang
        angle = pi2 * (i + 1)
        p = Polar(rate * angle, angle)
        tang = tangent(angle)
        p2 = p - tang
        path.AppendBezier(p1, p2, p, ContSymmetrical)
    return path
コード例 #4
0
ファイル: create_spiral.py プロジェクト: shumik/skencil-c
def create_spiral_path(rotation, radius):
    r = unit.convert(radius)
    rate = r / (rotation * 2 * pi)
    
    def tangent(phi, a = 0.55197 * rate):
        return a * Point(cos(phi) - phi * sin(phi),
                         sin(phi) + phi * cos(phi))
    pi2 = pi / 2.0
    angle = 0
    tang = tangent(0)
    path = CreatePath()
    p = Point(0, 0)
    path.AppendLine(p)
    for i in range(rotation * 4):
        p1 = p + tang
        angle = pi2 * (i + 1)
        p = Polar(rate * angle, angle)
        tang = tangent(angle)
        p2 = p - tang
        path.AppendBezier(p1, p2, p, ContSymmetrical)
    return path