예제 #1
0
    def to_symbolic(self):
        """Convert to a SymPy matrix representing :math:`B(s, t)`.

        .. note::

           This method requires SymPy.

        .. doctest:: triangle-to-symbolic

           >>> nodes = np.asfortranarray([
           ...     [0.0, 0.5, 1.0, -0.5, 0.0, -1.0],
           ...     [0.0, 0.0, 1.0,  0.0, 0.0,  0.0],
           ...     [0.0, 0.0, 0.0,  0.0, 0.0,  1.0],
           ... ])
           >>> triangle = bezier.Triangle(nodes, degree=2)
           >>> triangle.to_symbolic()
           Matrix([
           [s - t],
           [ s**2],
           [ t**2]])

        Returns:
            :class:`sympy.Matrix <sympy.matrices.dense.MutableDenseMatrix>`:
            The triangle :math:`B(s, t)`.
        """
        _, _, b_polynomial = _symbolic.triangle_as_polynomial(
            self._nodes, self._degree)
        return b_polynomial
예제 #2
0
    def _call_function_under_test(nodes, degree):
        from bezier import _symbolic

        return _symbolic.triangle_as_polynomial(nodes, degree)