mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Use _data_defaults for DotCloud radius
This commit is contained in:
parent
7e45558c55
commit
ca5e119425
1 changed files with 4 additions and 6 deletions
|
@ -53,14 +53,11 @@ class DotCloud(PMobject):
|
|||
opacity=opacity,
|
||||
**kwargs
|
||||
)
|
||||
self.set_radius(self.radius)
|
||||
|
||||
if points is not None:
|
||||
self.set_points(points)
|
||||
|
||||
def init_data(self) -> None:
|
||||
super().init_data()
|
||||
self.set_radius(self.radius)
|
||||
|
||||
def init_uniforms(self) -> None:
|
||||
super().init_uniforms()
|
||||
self.uniforms["glow_factor"] = self.glow_factor
|
||||
|
@ -102,7 +99,7 @@ class DotCloud(PMobject):
|
|||
return self
|
||||
|
||||
def set_radii(self, radii: npt.ArrayLike):
|
||||
n_points = len(self.get_points())
|
||||
n_points = self.get_num_points()
|
||||
radii = np.array(radii).reshape((len(radii), 1))
|
||||
self.data["radius"][:] = resize_with_interpolation(radii, n_points)
|
||||
self.refresh_bounding_box()
|
||||
|
@ -112,7 +109,8 @@ class DotCloud(PMobject):
|
|||
return self.data["radius"]
|
||||
|
||||
def set_radius(self, radius: float):
|
||||
self.data["radius"][:] = radius
|
||||
data = self.data if self.get_num_points() > 0 else self._data_defaults
|
||||
data["radius"][:] = radius
|
||||
self.refresh_bounding_box()
|
||||
return self
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue