Exemplo n.º 1
0
    def test_implicitize_bad_dimension(self):
        nodes = np.empty((1, 2), order="F")
        curve = self._make_one(nodes, 1, copy=False)
        with self.assertRaises(ValueError) as exc_info:
            curve.implicitize()

        exc_args = exc_info.exception.args
        self.assertEqual(
            exc_args,
            (
                "Only a planar (2D) curve can be implicitized",
                "Current dimension",
                1,
            ),
        )
Exemplo n.º 2
0
    def test_implicitize(self):
        nodes = np.asfortranarray([[3, 3, 4, 6], [3, 3, 3, 0]])
        curve = self._make_one(nodes, 3, copy=False)
        f_polynomial = curve.implicitize()

        x_sym, y_sym = sympy.symbols("x, y")
        expected = -9 * (x_sym**3 - 9 * x_sym**2 + 27 * x_sym - 3 * y_sym**2 +
                         18 * y_sym - 54)
        self.assertTrue(test__symbolic.sympy_equal(f_polynomial, expected))