mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 18:47:46 +00:00
commit
aedde4dffc
4 changed files with 11 additions and 10 deletions
|
|
@ -81,7 +81,6 @@ class Matrix(VMobject):
|
|||
bracket_v_buff: float = 0.25,
|
||||
add_background_rectangles_to_entries: bool = False,
|
||||
include_background_rectangle: bool = False,
|
||||
element_config: dict = dict(),
|
||||
element_alignment_corner: Vect3 = DOWN,
|
||||
**kwargs
|
||||
):
|
||||
|
|
@ -89,9 +88,9 @@ class Matrix(VMobject):
|
|||
Matrix can either include numbers, tex_strings,
|
||||
or mobjects
|
||||
"""
|
||||
super().__init__(**kwargs)
|
||||
super().__init__()
|
||||
|
||||
mob_matrix = self.matrix_to_mob_matrix(matrix, **element_config)
|
||||
mob_matrix = self.matrix_to_mob_matrix(matrix, **kwargs)
|
||||
self.mob_matrix = mob_matrix
|
||||
|
||||
self.organize_mob_matrix(mob_matrix, v_buff, h_buff, element_alignment_corner)
|
||||
|
|
|
|||
|
|
@ -528,7 +528,6 @@ class Mobject(object):
|
|||
|
||||
# Copying and serialization
|
||||
|
||||
@staticmethod
|
||||
def stash_mobject_pointers(func: Callable):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
|
|
@ -1735,7 +1734,6 @@ class Mobject(object):
|
|||
|
||||
# Operations touching shader uniforms
|
||||
|
||||
@staticmethod
|
||||
def affects_shader_info_id(func: Callable):
|
||||
@wraps(func)
|
||||
def wrapper(self):
|
||||
|
|
|
|||
|
|
@ -904,7 +904,7 @@ class VMobject(Mobject):
|
|||
if self.has_fill():
|
||||
tri1 = mobject1.get_triangulation()
|
||||
tri2 = mobject2.get_triangulation()
|
||||
if len(tri1) != len(tri1) or not np.all(tri1 == tri2):
|
||||
if len(tri1) != len(tri2) or not (tri1 == tri2).all():
|
||||
self.refresh_triangulation()
|
||||
return self
|
||||
|
||||
|
|
@ -1019,7 +1019,6 @@ class VMobject(Mobject):
|
|||
self.needs_new_triangulation = False
|
||||
return tri_indices
|
||||
|
||||
@staticmethod
|
||||
def triggers_refreshed_triangulation(func: Callable):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
|
|
@ -1126,9 +1125,11 @@ class VMobject(Mobject):
|
|||
stroke_shader_wrappers,
|
||||
]
|
||||
for sw, sw_list in zip(self.shader_wrapper_list, sw_lists):
|
||||
if not sw_list:
|
||||
continue
|
||||
sw.read_in(*sw_list)
|
||||
sw.depth_test = self.depth_test
|
||||
sw.uniforms = self.uniforms
|
||||
sw.depth_test = any(sw.depth_test for sw in sw_list)
|
||||
sw.uniforms.update(sw_list[0].uniforms)
|
||||
return list(filter(lambda sw: len(sw.vert_data) > 0, self.shader_wrapper_list))
|
||||
|
||||
def get_stroke_shader_data(self) -> np.ndarray:
|
||||
|
|
|
|||
|
|
@ -24,9 +24,12 @@ CLOSED_THRESHOLD = 0.001
|
|||
def bezier(
|
||||
points: Sequence[Scalable]
|
||||
) -> Callable[[float], Scalable]:
|
||||
if len(points) == 0:
|
||||
raise Exception("bezier cannot be calld on an empty list")
|
||||
|
||||
n = len(points) - 1
|
||||
|
||||
def result(t: Scalable) -> Scalable:
|
||||
def result(t: float) -> Scalable:
|
||||
return sum(
|
||||
((1 - t)**(n - k)) * (t**k) * choose(n, k) * point
|
||||
for k, point in enumerate(points)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue