Kill CONFIG in vector_space_scene and move to once_useful_constructs

This commit is contained in:
Grant Sanderson 2022-12-15 08:08:40 -08:00
parent 0b994db0ec
commit c57f1f997a

View file

@ -33,12 +33,16 @@ from manimlib.utils.rate_functions import rush_into
from manimlib.utils.space_ops import angle_of_vector from manimlib.utils.space_ops import angle_of_vector
from manimlib.utils.space_ops import get_norm from manimlib.utils.space_ops import get_norm
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from manimlib.constants import ManimColor
from typing import List
X_COLOR = GREEN_C X_COLOR = GREEN_C
Y_COLOR = RED_C Y_COLOR = RED_C
Z_COLOR = BLUE_D Z_COLOR = BLUE_D
# TODO: Much of this scene type seems dependent on the coordinate system chosen. # TODO: Much of this scene type seems dependent on the coordinate system chosen.
# That is, being centered at the origin with grid units corresponding to the # That is, being centered at the origin with grid units corresponding to the
# arbitrary space units. Change it! # arbitrary space units. Change it!
@ -46,9 +50,7 @@ Z_COLOR = BLUE_D
# Also, methods I would have thought of as getters, like coords_to_vector, are # Also, methods I would have thought of as getters, like coords_to_vector, are
# actually doing a lot of animating. # actually doing a lot of animating.
class VectorScene(Scene): class VectorScene(Scene):
CONFIG = { basis_vector_stroke_width: int = 6
"basis_vector_stroke_width": 6
}
def add_plane(self, animate=False, **kwargs): def add_plane(self, animate=False, **kwargs):
plane = NumberPlane(**kwargs) plane = NumberPlane(**kwargs)
@ -279,34 +281,30 @@ class VectorScene(Scene):
class LinearTransformationScene(VectorScene): class LinearTransformationScene(VectorScene):
CONFIG = { include_background_plane: bool = True
"include_background_plane": True, include_foreground_plane: bool = True
"include_foreground_plane": True, foreground_plane_kwargs: dict = dict(
"foreground_plane_kwargs": { x_max=FRAME_WIDTH / 2,
"x_max": FRAME_WIDTH / 2, x_min=-FRAME_WIDTH / 2,
"x_min": -FRAME_WIDTH / 2, y_max=FRAME_WIDTH / 2,
"y_max": FRAME_WIDTH / 2, y_min=-FRAME_WIDTH / 2,
"y_min": -FRAME_WIDTH / 2, faded_line_ratio=0
"faded_line_ratio": 0 )
}, background_plane_kwargs: dict = dict(
"background_plane_kwargs": { color=GREY,
"color": GREY, axis_config=dict(color=GREY),
"axis_config": { background_line_style=dict(
"color": GREY, stroke_color=GREY,
}, stroke_width=1,
"background_line_style": { ),
"stroke_color": GREY, )
"stroke_width": 1, show_coordinates: bool = True
}, show_basis_vectors: bool = True
}, basis_vector_stroke_width: float = 6.0
"show_coordinates": False, i_hat_color: ManimColor = X_COLOR
"show_basis_vectors": True, j_hat_color: ManimColor = Y_COLOR
"basis_vector_stroke_width": 6, leave_ghost_vectors: bool = False
"i_hat_color": X_COLOR, t_matrix: List[List[float]] = [[3, 0], [1, 2]]
"j_hat_color": Y_COLOR,
"leave_ghost_vectors": False,
"t_matrix": [[3, 0], [1, 2]],
}
def setup(self): def setup(self):
# The has_already_setup attr is to not break all the old Scenes # The has_already_setup attr is to not break all the old Scenes