Skip to content

Commit 0976f23

Browse files
k4pranhydrobeam
andauthored
Remove deprecated u-min/max and v-min/max in Surface (#2061)
Co-authored-by: Laith Bahodi <[email protected]>
1 parent 568db8f commit 0976f23

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

manim/mobject/three_dimensions.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ def construct(self):
7676
self.add(axes, surface)
7777
"""
7878

79-
@deprecated_params(
80-
params="u_min,u_max,v_min,v_max",
81-
since="v0.9.0",
82-
until="v0.10.0",
83-
message="Use u_range and v_range instead.",
84-
)
8579
def __init__(
8680
self,
8781
func: Callable[[float, float], np.ndarray],
@@ -98,10 +92,8 @@ def __init__(
9892
pre_function_handle_to_anchor_scale_factor: float = 0.00001,
9993
**kwargs
10094
) -> None:
101-
self.u_min = kwargs.pop("u_min", None) or u_range[0]
102-
self.u_max = kwargs.pop("u_max", None) or u_range[1]
103-
self.v_min = kwargs.pop("v_min", None) or v_range[0]
104-
self.v_max = kwargs.pop("v_max", None) or v_range[1]
95+
self.u_range = u_range
96+
self.v_range = v_range
10597
super().__init__(**kwargs)
10698
self.resolution = resolution
10799
self.surface_piece_config = surface_piece_config
@@ -126,13 +118,9 @@ def get_u_values_and_v_values(self):
126118
u_res = v_res = res[0]
127119
else:
128120
u_res, v_res = res
129-
u_min = self.u_min
130-
u_max = self.u_max
131-
v_min = self.v_min
132-
v_max = self.v_max
133121

134-
u_values = np.linspace(u_min, u_max, u_res + 1)
135-
v_values = np.linspace(v_min, v_max, v_res + 1)
122+
u_values = np.linspace(*self.u_range, u_res + 1)
123+
v_values = np.linspace(*self.v_range, v_res + 1)
136124

137125
return u_values, v_values
138126

@@ -634,24 +622,22 @@ def add_bases(self):
634622
"""Adds the end caps of the cylinder."""
635623
color = self.color if config["renderer"] == "opengl" else self.fill_color
636624
opacity = self.opacity if config["renderer"] == "opengl" else self.fill_opacity
637-
u_min = self.u_range[0] if config["renderer"] == "opengl" else self.u_min
638-
u_max = self.u_range[1] if config["renderer"] == "opengl" else self.u_max
639625
self.base_top = Circle(
640626
radius=self.radius,
641627
color=color,
642628
fill_opacity=opacity,
643629
shade_in_3d=True,
644630
stroke_width=0,
645631
)
646-
self.base_top.shift(u_max * IN)
632+
self.base_top.shift(self.u_range[1] * IN)
647633
self.base_bottom = Circle(
648634
radius=self.radius,
649635
color=color,
650636
fill_opacity=opacity,
651637
shade_in_3d=True,
652638
stroke_width=0,
653639
)
654-
self.base_bottom.shift(u_min * IN)
640+
self.base_bottom.shift(self.u_range[0] * IN)
655641
self.add(self.base_top, self.base_bottom)
656642

657643
def _rotate_to_direction(self):

tests/test_graphical_units/test_threed.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ def param_trig(u, v):
117117
trig_plane = Surface(
118118
lambda x, y: axes.c2p(x, y, param_trig(x, y)),
119119
resolution=(resolution_fa, resolution_fa),
120-
v_min=-3,
121-
v_max=+3,
122-
u_min=-3,
123-
u_max=+3,
120+
v_range=[-3, 3],
121+
u_range=[-3, 3],
124122
)
125123
trig_plane.set_fill_by_value(axes=axes, colors=[BLUE, GREEN, YELLOW, ORANGE, RED])
126124
scene.add(axes, trig_plane)

0 commit comments

Comments
 (0)