def test_complex_ellipse_with_spline_intersection(self):
     ellipse = ConstructionEllipse(center=(0, 0), major_axis=(3, 0), ratio=0.5)
     bspline = BSpline([(-4, -4), (-2, -1), (2, 1), (4, 4)])
     p1 = ellipse.flattening(distance=0.01)
     p2 = bspline.flattening(distance=0.01)
     res = intersect_polylines_2d(Vec2.list(p1), Vec2.list(p2))
     assert len(res) == 2
예제 #2
0
def test_flattening_ellipse():
    # Visually checked in BricsCAD:
    e = ConstructionEllipse(major_axis=(3, 0), ratio=0.25)
    assert len(list(e.flattening(0.1))) == 13
    assert len(list(e.flattening(0.01))) == 37
예제 #3
0
def test_flattening(s, e, distance, count):
    ellipse = ConstructionEllipse(
        start_param=math.radians(s),
        end_param=math.radians(e),
    )
    assert len(list(ellipse.flattening(distance, segments=2))) == count