A community-maintained Python framework for creating mathematical animations.
DashedVMobject should handle case when num_dashes=0
Grant Sanderson84a950425cae
diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.pyindex 433f9f673..12380786d 100644--- a/manimlib/mobject/types/vectorized_mobject.py+++ b/manimlib/mobject/types/vectorized_mobject.py@@ -918,22 +918,22 @@ class DashedVMobject(VMobject):VMobject.__init__(self, **kwargs)num_dashes = self.num_dashesps_ratio = self.positive_space_ratio+ if num_dashes > 0:+ # End points of the unit interval for division+ alphas = np.linspace(0, 1, num_dashes + 1)- # End points of the unit interval for division- alphas = np.linspace(0, 1, num_dashes + 1)+ # This determines the length of each "dash"+ full_d_alpha = (1.0 / num_dashes)+ partial_d_alpha = full_d_alpha * ps_ratio- # This determines the length of each "dash"- full_d_alpha = (1.0 / num_dashes)- partial_d_alpha = full_d_alpha * ps_ratio+ # Rescale so that the last point of vmobject will+ # be the end of the last dash+ alphas /= (1 - full_d_alpha + partial_d_alpha)- # Rescale so that the last point of vmobject will- # be the end of the last dash- alphas /= (1 - full_d_alpha + partial_d_alpha)-- self.add(*[- vmobject.get_subcurve(alpha, alpha + partial_d_alpha)- for alpha in alphas[:-1]- ])+ self.add(*[+ vmobject.get_subcurve(alpha, alpha + partial_d_alpha)+ for alpha in alphas[:-1]+ ])# Family is already taken care of by get_subcurve# implementationself.match_style(vmobject, family=False)