示例#1
0
def test_unit_circle():
    circle = shapes.unit_circle()
    assert circle.has_curves
    assert len(circle) == 4, "expected 4 cubic Bèzier segments"
    assert circle.start.isclose((1, 0, 0))
    assert circle.end.isclose((1, 0, 0))
示例#2
0
def test_rotated_ellipse():
    m = shapes.elliptic_transformation(ratio=0.5, rotation=math.pi / 2)
    circle = shapes.unit_circle(transform=m)
    extends = bbox([circle])
    assert extends.extmin.isclose((-0.5, -1.0))
    assert extends.extmax.isclose((0.5, 1.0))
示例#3
0
def test_move_circle():
    m = shapes.elliptic_transformation(center=(-1, 0, 0))
    circle = shapes.unit_circle(transform=m)
    assert circle.start.isclose((0, 0, 0))
示例#4
0
def test_ellipse():
    m = shapes.elliptic_transformation(ratio=0.5)
    circle = shapes.unit_circle(transform=m)
    extends = bbox([circle])
    assert extends.extmin.isclose((-1.0, -0.5))
    assert extends.extmax.isclose((1.0, 0.5))
示例#5
0
def test_scale_circle():
    m = shapes.elliptic_transformation(radius=2)
    circle = shapes.unit_circle(transform=m)
    assert circle.start.isclose((2, 0, 0))