Esempio n. 1
0
def test_chord_length_t_array(fit_points):
    t_vector = list(distance_t_vector(fit_points))
    assert len(t_vector) == len(fit_points)
    assert t_vector[0] == 0.
    assert t_vector[-1] == 1.
    for t1, t2 in zip(t_vector, t_vector[1:]):
        assert t1 <= t2
Esempio n. 2
0
def test_double_knots(p, fit_points_2):
    t_vector = list(distance_t_vector(fit_points_2))
    n = len(fit_points_2) - 1

    # create knots for each control point and 1st derivative
    knots = double_knots(n, p, t_vector)
    check_knots((n + 1) * 2, p + 1, knots)
Esempio n. 3
0
def test_constrained_natural_knots(p, fit_points_2):
    t_vector = list(distance_t_vector(fit_points_2))
    n = len(fit_points_2) - 1

    # add 2 knots for tangents
    knots = natural_knots_constrained(n + 2, p, t_vector)
    check_knots(n + 3, p + 1, knots)
def test_knot_generation(p, method):
    fit_points = Vec3.list([(0, 0), (0, 10), (10, 10), (20, 10), (20, 0),
                            (30, 0), (30, 10), (40, 10), (40, 0)])
    count = len(fit_points)
    n = count - 1
    order = p + 1
    t_vector = distance_t_vector(fit_points)
    knots = list(knots_from_parametrization(n, p, t_vector, method))
    check_knots(n + 1, p + 1, knots)
Esempio n. 5
0
def test_unconstrained_averaged_knots(p, fit_points_2):
    t_vector = list(distance_t_vector(fit_points_2))
    n = len(fit_points_2) - 1

    knots = averaged_knots_unconstrained(n, p, t_vector)
    check_knots(n + 1, p + 1, knots)