mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Rename 'points' -> 'point'
This commit is contained in:
parent
3ba5237f9b
commit
90ac1fc0bf
6 changed files with 23 additions and 23 deletions
|
@ -1017,7 +1017,7 @@ class ArrowTip(Triangle):
|
|||
self.set_width(length, stretch=True)
|
||||
if tip_style == 1:
|
||||
self.set_height(length * 0.9, stretch=True)
|
||||
self.data["points"][4] += np.array([0.6 * length, 0, 0])
|
||||
self.data["point"][4] += np.array([0.6 * length, 0, 0])
|
||||
elif tip_style == 2:
|
||||
h = length / 2
|
||||
self.set_points(Dot().set_width(h).get_points())
|
||||
|
|
|
@ -69,11 +69,11 @@ class Mobject(object):
|
|||
('rgba', np.float32, (4,)),
|
||||
]
|
||||
data_dtype: np.dtype = np.dtype([
|
||||
('points', '<f4', (3,)),
|
||||
('rgba', '<f4', (4,)),
|
||||
('point', np.float32, (3,)),
|
||||
('rgba', np.float32, (4,)),
|
||||
])
|
||||
aligned_data_keys = ['points']
|
||||
pointlike_data_keys = ['points']
|
||||
aligned_data_keys = ['point']
|
||||
pointlike_data_keys = ['point']
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -188,13 +188,13 @@ class Mobject(object):
|
|||
|
||||
def set_points(self, points: Vect3Array):
|
||||
self.resize_points(len(points))
|
||||
self.data["points"][:] = points
|
||||
self.data["point"][:] = points
|
||||
return self
|
||||
|
||||
def append_points(self, new_points: Vect3Array):
|
||||
n = self.get_num_points()
|
||||
self.resize_points(n + len(new_points))
|
||||
self.data["points"][n:] = new_points
|
||||
self.data["point"][n:] = new_points
|
||||
self.refresh_bounding_box()
|
||||
return self
|
||||
|
||||
|
@ -241,7 +241,7 @@ class Mobject(object):
|
|||
return self
|
||||
|
||||
def get_points(self) -> Vect3Array:
|
||||
return self.data["points"]
|
||||
return self.data["point"]
|
||||
|
||||
def clear_points(self) -> None:
|
||||
self.resize_points(0)
|
||||
|
@ -1876,7 +1876,7 @@ class Mobject(object):
|
|||
|
||||
def get_shader_data(self):
|
||||
shader_data = self.get_resized_shader_data_array(self.get_num_points())
|
||||
self.read_data_to_shader(shader_data, "point", "points")
|
||||
self.read_data_to_shader(shader_data, "point", "point")
|
||||
return shader_data
|
||||
|
||||
def refresh_shader_data(self):
|
||||
|
|
|
@ -30,7 +30,7 @@ class DotCloud(PMobject):
|
|||
('color', np.float32, (4,)),
|
||||
]
|
||||
data_dtype: np.dtype = np.dtype([
|
||||
('points', np.float32, (3,)),
|
||||
('point', np.float32, (3,)),
|
||||
('radius', np.float32, (1,)),
|
||||
('rgba', np.float32, (4,)),
|
||||
])
|
||||
|
|
|
@ -25,7 +25,7 @@ class ImageMobject(Mobject):
|
|||
('opacity', np.float32, (1,)),
|
||||
]
|
||||
data_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
|
||||
('points', np.float32, (3,)),
|
||||
('point', np.float32, (3,)),
|
||||
('im_coords', np.float32, (2,)),
|
||||
('opacity', np.float32, (1,)),
|
||||
]
|
||||
|
@ -43,7 +43,7 @@ class ImageMobject(Mobject):
|
|||
|
||||
def init_data(self) -> None:
|
||||
super().init_data(length=4)
|
||||
self.data["points"][:] = [UL, DL, UR, DR]
|
||||
self.data["point"][:] = [UL, DL, UR, DR]
|
||||
self.data["im_coords"][:] = [(0, 0), (0, 1), (1, 0), (1, 1)]
|
||||
self.data["opacity"][:] = self.opacity
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ class Surface(Mobject):
|
|||
('color', np.float32, (4,)),
|
||||
]
|
||||
data_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
|
||||
('points', np.float32, (3,)),
|
||||
('point', np.float32, (3,)),
|
||||
('du_point', np.float32, (3,)),
|
||||
('dv_point', np.float32, (3,)),
|
||||
('rgba', np.float32, (4,)),
|
||||
]
|
||||
pointlike_data_keys = ['points', 'du_point', 'dv_point']
|
||||
pointlike_data_keys = ['point', 'du_point', 'dv_point']
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -131,7 +131,7 @@ class Surface(Mobject):
|
|||
return self.triangle_indices
|
||||
|
||||
def get_surface_points_and_nudged_points(self) -> tuple[Vect3Array, Vect3Array, Vect3Array]:
|
||||
return (self.data['points'], self.data['du_point'], self.data['dv_point'])
|
||||
return (self.data['point'], self.data['du_point'], self.data['dv_point'])
|
||||
|
||||
def get_unit_normals(self) -> Vect3Array:
|
||||
s_points, du_points, dv_points = self.get_surface_points_and_nudged_points()
|
||||
|
@ -156,7 +156,7 @@ class Surface(Mobject):
|
|||
return self
|
||||
|
||||
nu, nv = smobject.resolution
|
||||
for key in ['points', 'du_point', 'dv_point']:
|
||||
for key in ['point', 'du_point', 'dv_point']:
|
||||
self.data[key][:] = self.get_partial_points_array(
|
||||
self.data[key], a, b,
|
||||
(nu, nv, 3),
|
||||
|
@ -241,7 +241,7 @@ class Surface(Mobject):
|
|||
def get_shader_data(self) -> np.ndarray:
|
||||
s_points, du_points, dv_points = self.get_surface_points_and_nudged_points()
|
||||
shader_data = self.get_resized_shader_data_array(len(s_points))
|
||||
if "points" not in self.locked_data_keys:
|
||||
if "point" not in self.locked_data_keys:
|
||||
shader_data["point"] = s_points
|
||||
shader_data["du_point"] = du_points
|
||||
shader_data["dv_point"] = dv_points
|
||||
|
@ -294,7 +294,7 @@ class TexturedSurface(Surface):
|
|||
('opacity', np.float32, (1,)),
|
||||
]
|
||||
data_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
|
||||
('points', np.float32, (3,)),
|
||||
('point', np.float32, (3,)),
|
||||
('du_point', np.float32, (3,)),
|
||||
('dv_point', np.float32, (3,)),
|
||||
('im_coords', np.float32, (2,)),
|
||||
|
@ -337,7 +337,7 @@ class TexturedSurface(Surface):
|
|||
surf = self.uv_surface
|
||||
nu, nv = surf.resolution
|
||||
self.resize_points(surf.get_num_points())
|
||||
for key in ['points', 'du_point', 'dv_point']:
|
||||
for key in ['point', 'du_point', 'dv_point']:
|
||||
self.data[key][:] = surf.data[key]
|
||||
self.data['opacity'][:, 0] = surf.data["rgba"][:, 3]
|
||||
self.data["im_coords"] = np.array([
|
||||
|
|
|
@ -67,7 +67,7 @@ class VMobject(Mobject):
|
|||
("color", np.float32, (4,)),
|
||||
]
|
||||
data_dtype: Sequence[Tuple[str, type, Tuple[int]]] = [
|
||||
("points", np.float32, (3,)),
|
||||
("point", np.float32, (3,)),
|
||||
('fill_rgba', np.float32, (4,)),
|
||||
("stroke_rgba", np.float32, (4,)),
|
||||
("joint_angle", np.float32, (1,)),
|
||||
|
@ -1133,7 +1133,7 @@ class VMobject(Mobject):
|
|||
if not self.has_points():
|
||||
return self
|
||||
inner_ends = self.get_subpath_end_indices()[:-1]
|
||||
self.data["points"][inner_ends + 1] = self.data["points"][inner_ends + 2]
|
||||
self.data["point"][inner_ends + 1] = self.data["point"][inner_ends + 2]
|
||||
super().reverse_points()
|
||||
return self
|
||||
|
||||
|
@ -1242,7 +1242,7 @@ class VMobject(Mobject):
|
|||
if n == 0:
|
||||
return self.stroke_data
|
||||
|
||||
self.read_data_to_shader(self.stroke_data[:n], "point", "points")
|
||||
self.read_data_to_shader(self.stroke_data[:n], "point", "point")
|
||||
self.read_data_to_shader(self.stroke_data[:n], "color", "stroke_rgba")
|
||||
self.read_data_to_shader(self.stroke_data[:n], "stroke_width", "stroke_width")
|
||||
self.get_joint_angles() # Recomputes, only if refresh is needed
|
||||
|
@ -1257,7 +1257,7 @@ class VMobject(Mobject):
|
|||
self.fill_data = resize_array(self.fill_data, len(points))
|
||||
self.fill_data["vert_index"][:, 0] = range(len(points))
|
||||
|
||||
self.read_data_to_shader(self.fill_data, "point", "points")
|
||||
self.read_data_to_shader(self.fill_data, "point", "point")
|
||||
self.read_data_to_shader(self.fill_data, "color", "fill_rgba")
|
||||
self.read_data_to_shader(self.fill_data, "orientation", "orientation")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue