def test_curve_3436_3(self): knotvector = [0.0, 0.0, 0.0, 1.0, 1.0, 1.0] basis = SvNurbsBasisFunctions(knotvector) ts = np.array([1.61803397]) ns = basis.derivative(2, 2, 0)(ts) expected = np.array([1]) self.assert_numpy_arrays_equal(ns, expected, precision=8)
def test_basis_function(self): "Test basis functions values" v1s = [] for t in self.ts: v1 = basis_function_one(self.degree, self.knotvector, self.span, t) v1s.append(v1) v1s = np.array(v1s) functions = SvNurbsBasisFunctions(self.knotvector) v2s = functions.function(self.span, self.degree)(self.ts) self.assert_numpy_arrays_equal(v1s, v2s, precision=8)
def test_basis_function_3436(self): "Test basis functions values outside of bounds" v1s = [] ts = np.array([1.61803397]) for t in ts: v1 = basis_function_one(self.degree, self.knotvector, self.span, t) v1s.append(v1) v1s = np.array(v1s) functions = SvNurbsBasisFunctions(self.knotvector) v2s = functions.function(self.span, self.degree)(ts) self.assert_numpy_arrays_equal(v1s, v2s, precision=8)
def test_basis_derivative(self): "Test basis functions derivative" expected = np.array([ 0.0, 0.29085873, 0.53185596, 0.72299169, 0.86426593, 0.95567867, 0.99722992, 0.98891967, 0.93074792, 0.82271468, 0.66481994, 0.45706371, 0.19944598, -0.10803324, -0.46537396, -0.87257618, -1.32963989, -1.8365651, -2.3933518, -3.0 ]) functions = SvNurbsBasisFunctions(self.knotvector) d2s = functions.derivative(self.span, self.degree, 1)(self.ts) self.assert_numpy_arrays_equal(expected, d2s, precision=8)