当前位置: 首页>>代码示例>>Python>>正文


Python Pen.turn_right方法代码示例

本文整理汇总了Python中canoepaddle.pen.Pen.turn_right方法的典型用法代码示例。如果您正苦于以下问题:Python Pen.turn_right方法的具体用法?Python Pen.turn_right怎么用?Python Pen.turn_right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在canoepaddle.pen.Pen的用法示例。


在下文中一共展示了Pen.turn_right方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_offwidth_arc_joins

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_offwidth_arc_joins():
    # Join arcs and lines of different widths.
    p = Pen()
    p.move_to((0, 0))
    p.turn_to(0)

    p.stroke_mode(0.8)
    p.line_forward(5)
    p.turn_left(45)
    p.stroke_mode(3.0)
    p.arc_left(90, 5)

    p.turn_to(-180)
    p.line_forward(5)
    p.turn_left(45)
    p.stroke_mode(0.8)
    p.arc_left(45, 5)

    p.turn_right(90)
    p.stroke_mode(3.0)
    p.arc_right(90, 4)

    assert_svg_file(
        p, 3,
        'test_offwidth_arc_joins.svg'
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:28,代码来源:test_pen.py

示例2: test_outliner_mode

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_outliner_mode():
    # We can set up a pattern in one mode,
    p = Pen()
    p.set_mode(StrokeOutlineMode(sqrt3, 0.2 * sqrt3, 'blue', 'black'))

    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(5, end_slant=60)

    # Then continue it in another mode without caring what the first mode was.
    old_mode = p.mode
    p.set_mode(p.mode.outliner_mode())

    p.turn_to(60)
    p.move_forward(1.0)

    p.turn_left(60)
    p.line_forward(2.0)
    p.turn_right(120)
    p.line_forward(2.0)
    p.turn_right(120)
    p.line_forward(2.0)

    p.turn_to(60)
    p.move_forward(3.0)
    p.turn_to(120)

    p.set_mode(old_mode)

    p.line_forward(5, start_slant=60)

    assert_svg_file(
        p, 3,
        'test_outliner_mode.svg'
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:37,代码来源:test_pen.py

示例3: test_line_line_half_illegal_joint

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_line_line_half_illegal_joint():
    # The outside edge meets, but the inside is too short to meet.
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)

    p.line_forward(2)
    p.turn_left(165)
    p.line_forward(2)

    assert_path_data(
        p, 2,
        (
            'M0.00,-0.50 L0.00,0.50 L5.80,0.50 L0.20,-1.00 '
            'L-0.06,-0.03 L1.87,0.48 L2.00,-0.50 L0.00,-0.50 z'
        )
    )

    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)

    p.line_forward(2)
    p.turn_right(165)
    p.line_forward(2)

    assert_path_data(
        p, 2,
        (
            'M0.00,-0.50 L0.00,0.50 L2.00,0.50 L1.87,-0.48 '
            'L-0.06,0.03 L0.20,1.00 L5.80,-0.50 L0.00,-0.50 z'
        )
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:37,代码来源:test_segment.py

示例4: test_long_line_thick

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_long_line_thick():
    p = Pen()
    p.stroke_mode(2.0)
    p.move_to((0, 0))
    p.turn_to(0)
    for _ in range(2):
        p.line_forward(5)
        p.turn_right(90)
        p.line_forward(5)
        p.turn_left(90)

    assert_path_data(
        p, 0,
        'M0,-1 L0,1 L4,1 L4,6 L9,6 L9,10 L11,10 L11,4 L6,4 L6,-1 L0,-1 z'
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:17,代码来源:test_pen.py

示例5: test_joint

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_joint():
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((-6, 0))
    p.turn_to(0)
    p.line_forward(6)
    p.turn_right(60)
    p.line_forward(6)

    assert_path_data(
        p, 2,
        (
            'M-6.00,-0.50 L-6.00,0.50 L-0.29,0.50 L2.57,5.45 '
            'L3.43,4.95 L0.29,-0.50 L-6.00,-0.50 z'
        ),
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:18,代码来源:test_pen.py

示例6: test_color_joint

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_color_joint():
    p = Pen()

    p.stroke_mode(1.0, 'red')
    p.move_to((-6, 0))
    p.turn_to(0)
    p.line_forward(6)

    p.stroke_mode(1.0, 'green')
    p.turn_right(60)
    p.line_forward(6)

    assert_path_data(
        p, 2,
        [
            'M-6.00,-0.50 L-6.00,0.50 L-0.29,0.50 L0.29,-0.50 L-6.00,-0.50 z',
            'M0.29,-0.50 L-0.29,0.50 L2.57,5.45 L3.43,4.95 L0.29,-0.50 z',
        ]
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:21,代码来源:test_pen.py

示例7: test_log

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_log():
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to(Point(-6, 0))
    p.turn_to(0)
    p.line_forward(6)
    p.turn_right(60)
    p.line_forward(6, end_slant=0)
    assert_equal(
        p.log(),
        [
            'stroke_mode(1.0)',
            'move_to((-6, 0))',  # Points are converted to tuples.
            'turn_to(0)',
            'line_forward(6)',
            'turn_right(60)',
            'line_forward(6, end_slant=0)',
        ]
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:21,代码来源:test_pen.py

示例8: test_various_joins

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_various_joins():
    p = Pen()
    p.stroke_mode(0.5)
    p.move_to((-2, 0))
    p.turn_to(0)
    p.line_forward(1)
    p.turn_left(90)
    p.line_forward(1)
    p.turn_right(90)
    p.arc_right(90, 1)
    p.arc_left(90, 1)
    p.turn_left(90)
    p.line_forward(1)

    p.paper.override_bounds(-3, -3, 3, 3)

    assert_svg_file(
        p, 2,
        'test_various_joins.svg',
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:22,代码来源:test_pen.py

示例9: test_turn_back_no_joint

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_turn_back_no_joint():
    # Make a line turn back on itself, and it doesn't join.
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(10)
    p.turn_right(180)
    p.line_forward(5)

    line1, line2 = p.last_path().segments
    assert line1.end_joint_illegal
    assert line2.start_joint_illegal

    assert_path_data(
        p, 1,
        (
            'M0.0,-0.5 L0.0,0.5 L10.0,0.5 L10.0,-0.5 '
            'L5.0,-0.5 L5.0,0.5 L10.0,0.5 L10.0,-0.5 L0.0,-0.5 z'
        )
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:23,代码来源:test_segment.py

示例10: test_close_loop_joint_error

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_close_loop_joint_error():
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)

    p.line_forward(10)
    p.turn_right(90)
    p.line_forward(10)
    p.turn_right(180)
    p.arc_left(90, 10)

    arc = p.last_segment()
    assert arc.start_joint_illegal
    assert arc.end_joint_illegal

    assert_path_data(
        p, 2,
        (
            'M4.47,0.50 L9.50,0.50 L9.50,5.53 A 10.50,10.50 0 0 0 4.47,0.50 z '
            'M0.00,-0.50 L0.00,0.50 A 9.50,9.50 0 0 1 9.50,10.00 '
            'L10.50,10.00 L10.50,-0.50 L0.00,-0.50 z'
        )
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:26,代码来源:test_segment.py

示例11: test_arc_arc_joint

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_arc_arc_joint():
    top = (0, 5)
    left = (-2, 0)
    right = (2, 0)

    # Convex-convex.
    p = Pen()
    p.stroke_mode(1.0)

    p.move_to(left)
    p.turn_toward(top)
    p.turn_left(5)
    p.arc_to(top, start_slant=0)
    p.turn_toward(right)
    p.turn_left(5)
    p.arc_to(right, end_slant=0)

    assert_path_data(
        p, 3,
        (
            'M-2.522,0.000 L-1.477,0.000 '
            'A 30.394,30.394 0 0 1 0.000,-3.853 '
            'A 30.394,30.394 0 0 1 1.477,0.000 '
            'L2.522,0.000 '
            'A 31.394,31.394 0 0 0 0.000,-6.076 '
            'A 31.394,31.394 0 0 0 -2.522,0.000 z'
        )
    )

    # Concave-concave.
    p = Pen()
    p.stroke_mode(1.0)

    p.move_to(left)
    p.turn_toward(top)
    p.turn_right(5)
    p.arc_to(top, start_slant=0)
    p.turn_toward(right)
    p.turn_right(5)
    p.arc_to(right, end_slant=0)

    assert_path_data(
        p, 3,
        (
            'M-2.561,0.000 L-1.441,0.000 '
            'A 31.394,31.394 0 0 0 0.000,-3.400 '
            'A 31.394,31.394 0 0 0 1.441,0.000 '
            'L2.561,0.000 '
            'A 30.394,30.394 0 0 1 0.000,-6.923 '
            'A 30.394,30.394 0 0 1 -2.561,0.000 z'
        )
    )

    # Convex-concave.
    p = Pen()
    p.stroke_mode(1.0)

    p.move_to(left)
    p.turn_toward(top)
    p.turn_left(5)
    p.arc_to(top, start_slant=0)
    p.turn_toward(right)
    p.turn_right(5)
    p.arc_to(right, end_slant=0)

    assert_path_data(
        p, 3,
        (
            'M-2.522,0.000 L-1.477,0.000 '
            'A 30.394,30.394 0 0 1 -0.090,-3.656 '
            'A 31.394,31.394 0 0 0 1.441,0.000 '
            'L2.561,0.000 '
            'A 30.394,30.394 0 0 1 0.144,-6.339 '
            'A 31.394,31.394 0 0 0 -2.522,0.000 z'
        )
    )

    # Concave-convex.
    p = Pen()
    p.stroke_mode(1.0)

    p.move_to(left)
    p.turn_toward(top)
    p.turn_right(5)
    p.arc_to(top, start_slant=0)
    p.turn_toward(right)
    p.turn_left(5)
    p.arc_to(right, end_slant=0)

    assert_path_data(
        p, 3,
        (
            'M-2.561,0.000 L-1.441,0.000 '
            'A 31.394,31.394 0 0 0 0.090,-3.656 '
            'A 30.394,30.394 0 0 1 1.477,0.000 '
            'L2.522,0.000 '
            'A 31.394,31.394 0 0 0 -0.144,-6.339 '
            'A 30.394,30.394 0 0 1 -2.561,0.000 z'
        )
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:102,代码来源:test_pen.py

示例12: test_too_sharp_joint

# 需要导入模块: from canoepaddle.pen import Pen [as 别名]
# 或者: from canoepaddle.pen.Pen import turn_right [as 别名]
def test_too_sharp_joint():
    # Joint is considered too sharp, so the joint is not made.
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(10)
    p.turn_left(175)
    p.line_forward(10)

    line1, line2 = p.last_path().segments
    assert line1.end_joint_illegal
    assert line2.start_joint_illegal

    assert_path_data(
        p, 2,
        (
            'M0.00,-0.50 L0.00,0.50 L10.00,0.50 L10.04,-0.50 L0.08,-1.37 '
            'L-0.01,-0.37 L9.96,0.50 L10.00,-0.50 L0.00,-0.50 z'
        )
    )

    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(10)
    p.turn_right(175)
    p.line_forward(10)

    line1, line2 = p.last_path().segments
    assert line1.end_joint_illegal
    assert line2.start_joint_illegal

    assert_path_data(
        p, 2,
        (
            'M0.00,-0.50 L0.00,0.50 L10.00,0.50 L9.96,-0.50 L-0.01,0.37 '
            'L0.08,1.37 L10.04,0.50 L10.00,-0.50 L0.00,-0.50 z'
        )
    )

    # Joint is considered too sharp, so the outside is not drawn, but the
    # inside joint works.
    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(20)
    p.turn_left(175)
    p.line_forward(20)

    line1, line2 = p.last_path().segments
    assert line1.end_joint_illegal
    assert line2.start_joint_illegal

    assert_path_data(
        p, 2,
        (
            'M0.00,-0.50 L0.00,0.50 L20.00,0.50 L20.04,-0.50 '
            'L0.12,-2.24 L0.03,-1.25 L8.55,-0.50 L0.00,-0.50 z'
        )
    )

    p = Pen()
    p.stroke_mode(1.0)
    p.move_to((0, 0))
    p.turn_to(0)
    p.line_forward(20)
    p.turn_right(175)
    p.line_forward(20)

    line1, line2 = p.last_path().segments
    assert line1.end_joint_illegal
    assert line2.start_joint_illegal

    assert_path_data(
        p, 2,
        (
            'M0.00,-0.50 L0.00,0.50 L8.55,0.50 L0.03,1.25 '
            'L0.12,2.24 L20.04,0.50 L20.00,-0.50 L0.00,-0.50 z'
        )
    )
开发者ID:christian-oudard,项目名称:canoepaddle,代码行数:85,代码来源:test_segment.py


注:本文中的canoepaddle.pen.Pen.turn_right方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。