Skip to content

Commit a7c8f4f

Browse files
committed
Reduce line cylinder height resolution to 2
Subdividing a line cylinder by its height adds no extra resolution - since it's not checkerboarded, all new rectangles would look the same as one long rectangle. Decreasing the default subdivision resolution to 2 reduces submobject count by 12x while sacrificing no quality.
1 parent 17e5a77 commit a7c8f4f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

manim/mobject/three_d/three_dimensions.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,8 @@ class Line3D(Cylinder):
895895
The thickness of the line.
896896
color
897897
The color of the line.
898+
resolution
899+
The cylinder resolution of the line.
898900
899901
Examples
900902
--------
@@ -915,10 +917,12 @@ def __init__(
915917
end: np.ndarray = RIGHT,
916918
thickness: float = 0.02,
917919
color: ParsableManimColor | None = None,
920+
resolution: int = 24,
918921
**kwargs,
919922
):
920923
self.thickness = thickness
921924
self.set_start_and_end_attrs(start, end, **kwargs)
925+
self.resolution = resolution
922926
if color is not None:
923927
self.set_color(color)
924928

@@ -951,6 +955,7 @@ def set_start_and_end_attrs(
951955
height=np.linalg.norm(self.vect),
952956
radius=self.thickness,
953957
direction=self.direction,
958+
resolution=(2, self.resolution),
954959
**kwargs,
955960
)
956961
self.shift((self.start + self.end) / 2)
@@ -1122,6 +1127,8 @@ class Arrow3D(Line3D):
11221127
The base radius of the conical tip.
11231128
color
11241129
The color of the arrow.
1130+
resolution
1131+
The resolution of the arrow line.
11251132
11261133
Examples
11271134
--------
@@ -1148,10 +1155,16 @@ def __init__(
11481155
height: float = 0.3,
11491156
base_radius: float = 0.08,
11501157
color: ParsableManimColor = WHITE,
1158+
resolution: int = 24,
11511159
**kwargs,
11521160
) -> None:
11531161
super().__init__(
1154-
start=start, end=end, thickness=thickness, color=color, **kwargs
1162+
start=start,
1163+
end=end,
1164+
thickness=thickness,
1165+
color=color,
1166+
resolution=resolution,
1167+
**kwargs
11551168
)
11561169

11571170
self.length = np.linalg.norm(self.vect)

0 commit comments

Comments
 (0)