Skip to content

The RC Param path.simplify does nothing. #8775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kbrose opened this issue Jun 18, 2017 · 1 comment
Closed

The RC Param path.simplify does nothing. #8775

kbrose opened this issue Jun 18, 2017 · 1 comment

Comments

@kbrose
Copy link
Contributor

kbrose commented Jun 18, 2017

There is no way to trigger the Path Simplification code externally. Setting the path.simplify RC parameter does not actually do anything.

The function definition and docstring for path.iter_segments looks like (I edited out irrelevant portions):

    def iter_segments(self, transform=None, remove_nans=True, clip=None,
                      snap=False, stroke_width=1.0, simplify=None,
                      curves=True, sketch=None):
        """
        Iterates over all of the curve segments in the path.  Each
        iteration returns a 2-tuple (*vertices*, *code*), where
        *vertices* is a sequence of 1 - 3 coordinate pairs, and *code* is
        one of the :class:`Path` codes.

        Additionally, this method can provide a number of standard
        cleanups and conversions to the path.

        Parameters
        ----------
        <<<removed>>>
        simplify : None or bool, optional
            If True, perform simplification, to remove
             vertices that do not affect the appearance of the path.  If
             False, perform no simplification.  If None, use the
             should_simplify member variable.
        <<<removed>>>
        """
        if not len(self):
            return

        cleaned = self.cleaned(transform=transform,
                               remove_nans=remove_nans, clip=clip,
                               snap=snap, stroke_width=stroke_width,
                               simplify=simplify, curves=curves,
                               sketch=sketch)

However, looking at the code for path.cleaned reveals that the None parameters are never overwritten as is claimed by the docstring for iter_segments.

    def cleaned(self, transform=None, remove_nans=False, clip=None,
                quantize=False, simplify=False, curves=False,
                stroke_width=1.0, snap=False, sketch=None):
        """
        Cleans up the path according to the parameters returning a new
        Path instance.

        .. seealso::

            See :meth:`iter_segments` for details of the keyword arguments.

        Returns
        -------
        Path instance with cleaned up vertices and codes.

        """
        vertices, codes = _path.cleanup_path(self, transform,
                                             remove_nans, clip,
                                             snap, stroke_width,
                                             simplify, curves, sketch)

However, I'm not sure that the existing path simplification code is behaving correctly (another Issue incoming, I'll link when it's done), so perhaps this is not a bad thing.

@kbrose kbrose mentioned this issue Jun 18, 2017
6 tasks
@anntzer
Copy link
Contributor

anntzer commented Jun 18, 2017

Well there is

    should_simplify_obj = PyObject_GetAttrString(obj, "should_simplify");
    if (should_simplify_obj == NULL) {
        goto exit;
    }
    should_simplify = PyObject_IsTrue(should_simplify_obj);

in py_converters.cpp, not sure if it matters (possibly not).

@kbrose kbrose closed this as completed Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants