Have density of anchor points on arcs depend on arc length

This commit is contained in:
Grant Sanderson 2025-02-07 10:17:02 -06:00
parent 045e1f6b8a
commit 46c898977a

View file

@ -208,12 +208,16 @@ class Arc(TipableVMobject):
start_angle: float = 0,
angle: float = TAU / 4,
radius: float = 1.0,
n_components: int = 8,
n_components: Optional[int] = None,
arc_center: Vect3 = ORIGIN,
**kwargs
):
super().__init__(**kwargs)
if n_components is None:
# 16 components for a full circle
n_components = int(15 * (abs(angle) / TAU)) + 1
self.set_points(quadratic_bezier_points_for_arc(angle, n_components))
self.rotate(start_angle, about_point=ORIGIN)
self.scale(radius, about_point=ORIGIN)