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))
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))
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))
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))
def test_scale_circle(): m = shapes.elliptic_transformation(radius=2) circle = shapes.unit_circle(transform=m) assert circle.start.isclose((2, 0, 0))