def test_line_2d(): nonzero_pole_indices, shape_functions = an.shape_functions( degree=1, order=1, knots=[0, 5], t=1.0566243270259357, ) assert_array_almost_equal( nonzero_pole_indices, [0, 1], ) assert_array_almost_equal( shape_functions, [[ 0.788675134594813, 0.21132486540518713], [-0.200000000000000, 0.20000000000000000]], ) nonzero_pole_indices, shape_functions = an.shape_functions( degree=1, order=1, knots=[0, 5], t=3.9433756729740645, ) assert_array_almost_equal( nonzero_pole_indices, [0, 1], ) assert_array_almost_equal( shape_functions, [[ 0.2113248654051871, 0.788675134594813], [-0.2000000000000000, 0.200000000000000]], )
def test_without_weights(): nonzero_pole_indices, shape_functions = an.shape_functions( degree=2, order=2, knots=[1, 1, 3, 3], t=2, ) assert_array_almost_equal( nonzero_pole_indices, [0, 1, 2], ) assert_array_almost_equal( shape_functions, [[ 0.25, 0.50, 0.25], [-0.50, 0.00, 0.50], [ 0.50, -1.00, 0.50]] )
def test_with_weights(): nonzero_pole_indices, shape_functions = an.shape_functions( degree=2, order=2, knots=[1, 1, 3, 3], weights=[1, 1.5, 1], t=2, ) assert_array_almost_equal( nonzero_pole_indices, [0, 1, 2], ) assert_array_almost_equal( shape_functions, [[ 0.20, 0.60, 0.20], [-0.40, 0.00, 0.40], [ 0.48, -0.96, 0.48]] )
def test_without_weights(self): nonzero_pole_indices, shape_functions = an.shape_functions( degree_u=2, degree_v=1, order=1, knots_u=[0, 0, 7.5, 15, 15], knots_v=[0, 10, 20], u=12, v=5, ) assert_almost_equal( nonzero_pole_indices, [(1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1)], ) assert_array_almost_equal( shape_functions[:2], [[0.04, 0.04, 0.28, 0.28, 0.18, 0.18], [-0.0266666667, -0.0266666667, -0.0533333333, -0.0533333333, 0.08, 0.08]], )
def test_with_weights(self): nonzero_pole_indices, shape_functions = an.shape_functions( degree_u=2, degree_v=1, order=1, knots_u=[0, 0, 7.5, 15, 15], knots_v=[0, 10, 20], weights=[[1, 1, 1], [1, 2.5, 1], [1, 1, 1], [1, 1, 1]], u=12, v=5, ) assert_almost_equal( nonzero_pole_indices, [(1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1)], ) assert_array_almost_equal( shape_functions[:2], [[ 0.0377358491, 0.0943396226, 0.2641509434, 0.2641509434, 0.1698113208, 0.1698113208], [-0.0237332384, -0.0593330960, -0.0403465053, -0.0403465053, 0.0818796725, 0.0818796725]], )