mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Default SVG paths and dots to have locked triangulation
This commit is contained in:
parent
095a3ef28c
commit
c780a7471b
3 changed files with 5 additions and 4 deletions
|
@ -1,4 +1,3 @@
|
||||||
import warnings
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from manimlib.constants import *
|
from manimlib.constants import *
|
||||||
|
@ -13,7 +12,6 @@ from manimlib.utils.simple_functions import fdiv
|
||||||
from manimlib.utils.space_ops import angle_of_vector
|
from manimlib.utils.space_ops import angle_of_vector
|
||||||
from manimlib.utils.space_ops import angle_between_vectors
|
from manimlib.utils.space_ops import angle_between_vectors
|
||||||
from manimlib.utils.space_ops import compass_directions
|
from manimlib.utils.space_ops import compass_directions
|
||||||
from manimlib.utils.space_ops import line_intersection
|
|
||||||
from manimlib.utils.space_ops import find_intersection
|
from manimlib.utils.space_ops import find_intersection
|
||||||
from manimlib.utils.space_ops import get_norm
|
from manimlib.utils.space_ops import get_norm
|
||||||
from manimlib.utils.space_ops import normalize
|
from manimlib.utils.space_ops import normalize
|
||||||
|
@ -317,6 +315,7 @@ class Dot(Circle):
|
||||||
|
|
||||||
def __init__(self, point=ORIGIN, **kwargs):
|
def __init__(self, point=ORIGIN, **kwargs):
|
||||||
Circle.__init__(self, arc_center=point, **kwargs)
|
Circle.__init__(self, arc_center=point, **kwargs)
|
||||||
|
self.lock_triangulation()
|
||||||
|
|
||||||
|
|
||||||
class SmallDot(Dot):
|
class SmallDot(Dot):
|
||||||
|
|
|
@ -316,7 +316,7 @@ class SVGMobject(VMobject):
|
||||||
|
|
||||||
class VMobjectFromSVGPathstring(VMobject):
|
class VMobjectFromSVGPathstring(VMobject):
|
||||||
def __init__(self, path_string, **kwargs):
|
def __init__(self, path_string, **kwargs):
|
||||||
digest_locals(self)
|
self.path_string = path_string
|
||||||
VMobject.__init__(self, **kwargs)
|
VMobject.__init__(self, **kwargs)
|
||||||
|
|
||||||
def init_points(self):
|
def init_points(self):
|
||||||
|
@ -328,6 +328,8 @@ class VMobjectFromSVGPathstring(VMobject):
|
||||||
self.subdivide_sharp_curves()
|
self.subdivide_sharp_curves()
|
||||||
# SVG treats y-coordinate differently
|
# SVG treats y-coordinate differently
|
||||||
self.stretch(-1, 1, about_point=ORIGIN)
|
self.stretch(-1, 1, about_point=ORIGIN)
|
||||||
|
# For faster rendering
|
||||||
|
self.lock_triangulation()
|
||||||
|
|
||||||
def get_commands_and_coord_strings(self):
|
def get_commands_and_coord_strings(self):
|
||||||
all_commands = list(self.get_command_to_function_map().keys())
|
all_commands = list(self.get_command_to_function_map().keys())
|
||||||
|
|
|
@ -56,11 +56,11 @@ class VMobject(Mobject):
|
||||||
# Could also be Bevel, Miter, Round
|
# Could also be Bevel, Miter, Round
|
||||||
"joint_type": "auto",
|
"joint_type": "auto",
|
||||||
"render_primative": moderngl.TRIANGLES,
|
"render_primative": moderngl.TRIANGLES,
|
||||||
|
"triangulation_locked": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.triangulation_locked = False
|
|
||||||
|
|
||||||
def get_group_class(self):
|
def get_group_class(self):
|
||||||
return VGroup
|
return VGroup
|
||||||
|
|
Loading…
Add table
Reference in a new issue