示例#1
0
 def test_evaluate_barycentric_negative_weights_no_verify(self):
     lambda_vals = (0.25, -0.5, 1.25)
     nodes = np.asfortranarray([[0.0, 1.0, 0.0], [0.0, 0.5, 1.25]])
     surface = self._make_one(nodes, 1)
     self.assertLess(min(lambda_vals), 0.0)
     result = surface.evaluate_barycentric(*lambda_vals, _verify=False)
     expected = np.asfortranarray([[-0.5], [1.3125]])
     self.assertEqual(result, expected)
示例#2
0
 def test_evaluate_barycentric_non_unity_weights_no_verify(self):
     lambda_vals = (0.25, 0.25, 0.25)
     nodes = np.asfortranarray([[0.0, 1.0, 0.0], [0.0, 0.5, 1.25]])
     surface = self._make_one(nodes, 1)
     self.assertNotEqual(sum(lambda_vals), 1.0)
     result = surface.evaluate_barycentric(*lambda_vals, _verify=False)
     expected = np.asfortranarray([[0.25], [0.4375]])
     self.assertEqual(result, expected)
示例#3
0
 def test_evaluate_barycentric(self):
     surface = self._make_one(self.UNIT_TRIANGLE, 1, _copy=False)
     lambda_vals = (0.25, 0.0, 0.75)
     # Just make sure we call the helper.
     patch = unittest.mock.patch(
         "bezier._surface_helpers.evaluate_barycentric",
         return_value=unittest.mock.sentinel.evaluated,
     )
     with patch as mocked:
         result = surface.evaluate_barycentric(*lambda_vals)
         self.assertIs(result, unittest.mock.sentinel.evaluated)
         mocked.assert_called_once_with(self.UNIT_TRIANGLE, 1, *lambda_vals)