Skip to content

Commit

Permalink
Fix negative path_arc case
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Oct 5, 2021
1 parent ed1fc4d commit 719c81d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion manimlib/mobject/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ def set_points_by_ends(self, start, end, buff=0, path_arc=0):
self.set_points_as_corners([start, end])
return self
if path_arc:
neg = path_arc < 0
if neg:
path_arc = -path_arc
start, end = end, start
radius = (dist / 2) / math.sin(path_arc / 2)
alpha = (PI - path_arc) / 2
center = start + radius * normalize(rotate_vector(end - start, alpha))
Expand All @@ -421,6 +425,8 @@ def set_points_by_ends(self, start, end, buff=0, path_arc=0):
angle=path_arc - 2 * buff / radius,
start_angle=angle_of_vector(start - center) + buff / radius,
)
if neg:
raw_arc_points = raw_arc_points[::-1]
self.set_points(center + radius * raw_arc_points)
else:
if buff > 0 and dist > 0:
Expand Down Expand Up @@ -585,7 +591,7 @@ def __init__(self, **kwargs):
class Arrow(Line):
CONFIG = {
"stroke_color": GREY_A,
"stroke_width": 10,
"stroke_width": 5,
"tip_width_ratio": 4,
"width_to_tip_len": 0.0075,
"max_tip_length_to_length_ratio": 0.3,
Expand Down

0 comments on commit 719c81d

Please sign in to comment.