Skip to content

Conversation

@mjmjmtl
Copy link

@mjmjmtl mjmjmtl commented Nov 15, 2025

Motivation

In SVG file, a reference path is created for same characters:
image
When parsing the path in SVGMobject, parsing the reference path is better because:

  1. It only stores one copy of path (for same character) in PATH_TO_POINTS cache.
  2. The numerical accuracy is slightly better when doing the transform by ourselves.

Proposed changes

Here's the code to test the change:

from manimlib import *
from manimlib.mobject.svg.svg_mobject import PATH_TO_POINTS


class SVGTransformShowcase(Scene):
    def construct(self):
        tex = Tex("aaaaa")
        tex.scale(3)
        self.add(tex)
        print(f"{len(PATH_TO_POINTS)=}")

before:
image

after:
image

Notice the difference in terminal output.

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

Successfully merging this pull request may close these issues.

1 participant