Skip to content

Commit

Permalink
Use MappingFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed Apr 30, 2024
1 parent 8331c71 commit 9bc32e2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions manim/mobject/vector_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import numpy.typing as npt
from typing_extensions import Self

from manim.typing import ManimFloat, Point3D, Vector3D
from manim.typing import ManimFloat, Point3D, Vector3D, MappingFunction

DEFAULT_SCALAR_FIELD_COLORS: list = [BLUE_E, GREEN, YELLOW, RED]

Expand Down Expand Up @@ -79,7 +79,7 @@ class VectorField(VGroup[VMobjectT]):

def __init__(
self,
func: Callable[[Point3D], npt.NDArray[ManimFloat]],
func: MappingFunction,
color: ParsableManimColor | None = None,
color_scheme: Callable[[Vector3D], float] | None = None,
min_color_scheme_value: float = 0,
Expand Down Expand Up @@ -126,9 +126,9 @@ def pos_to_rgb(pos: np.ndarray) -> tuple[float, float, float, float]:

@staticmethod
def shift_func(
func: Callable[[npt.NDArray[ManimFloat]], npt.NDArray],
func: MappingFunction,
shift_vector: Vector3D,
) -> Callable[[np.ndarray], np.ndarray]:
) -> MappingFunction:
"""Shift a vector field function.
Parameters
Expand All @@ -148,9 +148,9 @@ def shift_func(

@staticmethod
def scale_func(
func: Callable[[npt.NDArray[ManimFloat]], npt.NDArray],
func: MappingFunction,
scalar: float,
) -> Callable[[npt.NDArray[ManimFloat]], npt.NDArray]:
) -> MappingFunction:
"""Scale a vector field function.
Parameters
Expand Down Expand Up @@ -546,7 +546,7 @@ def construct(self):

def __init__(
self,
func: Callable[[npt.NDArray[ManimFloat]], npt.NDArray],
func: MappingFunction,
color: ParsableManimColor | None = None,
color_scheme: Callable[[npt.NDArray], float] | None = None,
min_color_scheme_value: float = 0,
Expand Down Expand Up @@ -720,7 +720,7 @@ def construct(self):

def __init__(
self,
func: Callable[[npt.NDArray[ManimFloat]], npt.NDArray],
func: MappingFunction,
color: ParsableManimColor | None = None,
color_scheme: Callable[[npt.NDArray], float] | None = None,
min_color_scheme_value: float = 0,
Expand Down

0 comments on commit 9bc32e2

Please sign in to comment.