예제 #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]])
     triangle = self._make_one(nodes, 1)
     self.assertLess(min(lambda_vals), 0.0)
     result = triangle.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]])
     triangle = self._make_one(nodes, 1)
     self.assertNotEqual(sum(lambda_vals), 1.0)
     result = triangle.evaluate_barycentric(*lambda_vals, _verify=False)
     expected = np.asfortranarray([[0.25], [0.4375]])
     self.assertEqual(result, expected)
예제 #3
0
 def test_evaluate_barycentric(self):
     triangle = 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._triangle_helpers.evaluate_barycentric",
         return_value=unittest.mock.sentinel.evaluated,
     )
     with patch as mocked:
         result = triangle.evaluate_barycentric(*lambda_vals)
         self.assertIs(result, unittest.mock.sentinel.evaluated)
         mocked.assert_called_once_with(self.UNIT_TRIANGLE, 1, *lambda_vals)