A community-maintained Python framework for creating mathematical animations.
Small adjustments to VMobject.insert_n_anchor_points
Grant Sanderson32b46e078c6a
diff --git a/mobject/vectorized_mobject.py b/mobject/vectorized_mobject.pyindex 2fb398c2d..f663367e8 100644--- a/mobject/vectorized_mobject.py+++ b/mobject/vectorized_mobject.py@@ -353,7 +353,8 @@ class VMobject(Mobject):for index in range(num_curves):curr_bezier_points = self.points[3*index:3*index+4]num_inter_curves = sum(index_allocation == index)- alphas = np.arange(0, num_inter_curves+1)/float(num_inter_curves)+ alphas = np.linspace(0, 1, num_inter_curves+1)+ # alphas = np.arange(0, num_inter_curves+1)/float(num_inter_curves)for a, b in zip(alphas, alphas[1:]):new_points = partial_bezier_points(curr_bezier_points, a, bdiff --git a/topics/geometry.py b/topics/geometry.pyindex 3605d8b6a..42cec5a9a 100644--- a/topics/geometry.py+++ b/topics/geometry.py@@ -333,6 +333,17 @@ class Line(VMobject):self.shift(new_start - self.get_start())return self+ def insert_n_anchor_points(self, n):+ if not self.path_arc:+ n_anchors = self.get_num_anchor_points()+ new_num_points = 3*(n_anchors + n)+1+ self.points = np.array([+ self.point_from_proportion(alpha)+ for alpha in np.linspace(0, 1, new_num_points)+ ])+ else:+ VMobject.insert_n_anchor_points(self, n)+class DashedLine(Line):CONFIG = {"dashed_segment_length" : 0.05