mirror of
https://github.com/3b1b/manim.git
synced 2025-11-15 20:47:44 +00:00
Move joint_type_map out of constants to VMobject
This commit is contained in:
parent
f9a44c9975
commit
7d3758c44c
2 changed files with 9 additions and 10 deletions
|
|
@ -59,6 +59,7 @@ BOTTOM: Vect3 = FRAME_Y_RADIUS * DOWN
|
||||||
LEFT_SIDE: Vect3 = FRAME_X_RADIUS * LEFT
|
LEFT_SIDE: Vect3 = FRAME_X_RADIUS * LEFT
|
||||||
RIGHT_SIDE: Vect3 = FRAME_X_RADIUS * RIGHT
|
RIGHT_SIDE: Vect3 = FRAME_X_RADIUS * RIGHT
|
||||||
|
|
||||||
|
# Angles
|
||||||
PI: float = np.pi
|
PI: float = np.pi
|
||||||
TAU: float = 2 * PI
|
TAU: float = 2 * PI
|
||||||
DEGREES: float = TAU / 360
|
DEGREES: float = TAU / 360
|
||||||
|
|
@ -66,13 +67,6 @@ DEGREES: float = TAU / 360
|
||||||
# when juxtaposed with expressions like 30 * DEGREES
|
# when juxtaposed with expressions like 30 * DEGREES
|
||||||
RADIANS: float = 1
|
RADIANS: float = 1
|
||||||
|
|
||||||
JOINT_TYPE_MAP: dict = {
|
|
||||||
"no_joint": 0,
|
|
||||||
"auto": 1,
|
|
||||||
"bevel": 2,
|
|
||||||
"miter": 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Related to Text
|
# Related to Text
|
||||||
NORMAL: str = "NORMAL"
|
NORMAL: str = "NORMAL"
|
||||||
ITALIC: str = "ITALIC"
|
ITALIC: str = "ITALIC"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ from manimlib.constants import GREY_A, GREY_C, GREY_E
|
||||||
from manimlib.constants import BLACK
|
from manimlib.constants import BLACK
|
||||||
from manimlib.constants import DEFAULT_STROKE_WIDTH
|
from manimlib.constants import DEFAULT_STROKE_WIDTH
|
||||||
from manimlib.constants import DEGREES
|
from manimlib.constants import DEGREES
|
||||||
from manimlib.constants import JOINT_TYPE_MAP
|
|
||||||
from manimlib.constants import ORIGIN, OUT
|
from manimlib.constants import ORIGIN, OUT
|
||||||
from manimlib.constants import PI
|
from manimlib.constants import PI
|
||||||
from manimlib.constants import TAU
|
from manimlib.constants import TAU
|
||||||
|
|
@ -72,6 +71,12 @@ class VMobject(Mobject):
|
||||||
make_smooth_after_applying_functions: bool = False
|
make_smooth_after_applying_functions: bool = False
|
||||||
# TODO, do we care about accounting for varying zoom levels?
|
# TODO, do we care about accounting for varying zoom levels?
|
||||||
tolerance_for_point_equality: float = 1e-8
|
tolerance_for_point_equality: float = 1e-8
|
||||||
|
joint_type_map: dict = {
|
||||||
|
"no_joint": 0,
|
||||||
|
"auto": 1,
|
||||||
|
"bevel": 2,
|
||||||
|
"miter": 3,
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
@ -123,7 +128,7 @@ class VMobject(Mobject):
|
||||||
super().init_uniforms()
|
super().init_uniforms()
|
||||||
self.uniforms.update(
|
self.uniforms.update(
|
||||||
anti_alias_width=self.anti_alias_width,
|
anti_alias_width=self.anti_alias_width,
|
||||||
joint_type=JOINT_TYPE_MAP[self.joint_type],
|
joint_type=self.joint_type_map[self.joint_type],
|
||||||
flat_stroke=float(self.flat_stroke),
|
flat_stroke=float(self.flat_stroke),
|
||||||
scale_stroke_with_zoom=float(self.scale_stroke_with_zoom)
|
scale_stroke_with_zoom=float(self.scale_stroke_with_zoom)
|
||||||
)
|
)
|
||||||
|
|
@ -406,7 +411,7 @@ class VMobject(Mobject):
|
||||||
|
|
||||||
def set_joint_type(self, joint_type: str, recurse: bool = True) -> Self:
|
def set_joint_type(self, joint_type: str, recurse: bool = True) -> Self:
|
||||||
for mob in self.get_family(recurse):
|
for mob in self.get_family(recurse):
|
||||||
mob.uniforms["joint_type"] = JOINT_TYPE_MAP[joint_type]
|
mob.uniforms["joint_type"] = self.joint_type_map[joint_type]
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def get_joint_type(self) -> float:
|
def get_joint_type(self) -> float:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue