def test_bspline_curve2d_remove_knot(spline_curve, param, num_remove): s_pre = helpers.find_multiplicity(param, spline_curve.knotvector) c_pre = spline_curve.ctrlpts_size spline_curve.remove_knot(param, num=num_remove) s_post = helpers.find_multiplicity(param, spline_curve.knotvector) c_post = spline_curve.ctrlpts_size assert c_pre - num_remove == c_post assert s_pre - num_remove == s_post
def test_bspline_surface_remove_knot_v(spline_surf, param, num_remove): s_pre = helpers.find_multiplicity(param, spline_surf.knotvector_v) c_pre = spline_surf.ctrlpts_size_v spline_surf.remove_knot(v=param, num_v=num_remove) s_post = helpers.find_multiplicity(param, spline_surf.knotvector_v) c_post = spline_surf.ctrlpts_size_v assert c_pre - num_remove == c_post assert s_pre - num_remove == s_post
def test_bspline_curve2d_insert_knot(spline_curve, param, num_insert, res): s_pre = helpers.find_multiplicity(param, spline_curve.knotvector) spline_curve.insert_knot(param, num=num_insert) s_post = helpers.find_multiplicity(param, spline_curve.knotvector) evalpt = spline_curve.evaluate_single(param) assert abs(evalpt[0] - res[0]) < GEOMDL_DELTA assert abs(evalpt[1] - res[1]) < GEOMDL_DELTA assert s_pre + num_insert == s_post
def test_bspline_curve2d_insert_knot(spline_curve, param, num_insert, res): s_pre = helpers.find_multiplicity(param, spline_curve.knotvector) spline_curve.insert_knot(param, num=num_insert) s_post = helpers.find_multiplicity(param, spline_curve.knotvector) evalpt = spline_curve.evaluate_single(param) assert abs(evalpt[0] - res[0]) < GEOMDL_DELTA assert abs(evalpt[1] - res[1]) < GEOMDL_DELTA assert s_pre + num_insert == s_post
def test_bspline_curve2d_remove_knot(spline_curve, param, num_remove): s_pre = helpers.find_multiplicity(param, spline_curve.knotvector) c_pre = spline_curve.ctrlpts_size spline_curve.remove_knot(param, num=num_remove) s_post = helpers.find_multiplicity(param, spline_curve.knotvector) c_post = spline_curve.ctrlpts_size assert c_pre - num_remove == c_post assert s_pre - num_remove == s_post
def test_find_multiplicity(): knot_vector = [0, 0, 0, 1, 2, 3, 4, 4, 5, 5, 5] knots = [0.5, 2, 4, 5] to_check = [helpers.find_multiplicity(_, knot_vector) for _ in knots] result = [0, 1, 2, 3] assert to_check == result
def test_find_multiplicity(): knot_vector = [0, 0, 0, 1, 2, 3, 4, 4, 5, 5, 5] knots = [0.5, 2, 4, 5] to_check = [helpers.find_multiplicity(_, knot_vector) for _ in knots] result = [0, 1, 2, 3] assert to_check == result
def test_bspline_surface_remove_knot_kv_v(spline_surf): spline_surf.remove_knot(v=0.33, num_v=1) s = helpers.find_multiplicity(0.33, spline_surf.knotvector_v) assert 0.33 not in spline_surf.knotvector_v assert s == 0
def test_bspline_surface_remove_knot_kv_u(spline_surf): spline_surf.remove_knot(u=0.66, num_u=1) s = helpers.find_multiplicity(0.66, spline_surf.knotvector_u) assert 0.66 not in spline_surf.knotvector_u assert s == 0
def test_bspline_curve2d_insert_knot_kv(spline_curve): spline_curve.insert_knot(0.66, num=2) s = helpers.find_multiplicity(0.66, spline_curve.knotvector) assert spline_curve.knotvector[5] == 0.66 assert s == 3
def test_bspline_curve2d_remove_knot_kv(spline_curve): spline_curve.remove_knot(0.66, num=1) s = helpers.find_multiplicity(0.66, spline_curve.knotvector) assert 0.66 not in spline_curve.knotvector assert s == 0
def test_bspline_curve2d_remove_knot_kv(spline_curve): spline_curve.remove_knot(0.66, num=1) s = helpers.find_multiplicity(0.66, spline_curve.knotvector) assert 0.66 not in spline_curve.knotvector assert s == 0
def test_bspline_curve2d_insert_knot_kv(spline_curve): spline_curve.insert_knot(0.66, num=2) s = helpers.find_multiplicity(0.66, spline_curve.knotvector) assert spline_curve.knotvector[5] == 0.66 assert s == 3