Skip to content

Commit

Permalink
Merge pull request 3b1b#1592 from AStarySky/patch-1
Browse files Browse the repository at this point in the history
fix put_start_and_end_on
  • Loading branch information
3b1b committed Aug 6, 2021
2 parents 121e621 + b0fd520 commit 31119b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions manimlib/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ def surround(self, mobject,
return self

def put_start_and_end_on(self, start, end):
# TODO, this doesn't currently work in 3d
curr_start, curr_end = self.get_start_and_end()
curr_vect = curr_end - curr_start
if np.all(curr_vect == 0):
Expand All @@ -842,9 +841,12 @@ def put_start_and_end_on(self, start, end):
)
self.rotate(
angle_of_vector(target_vect) - angle_of_vector(curr_vect),
about_point=curr_start
)
self.shift(start - curr_start)
self.rotate(
np.arctan2(curr_vect[2], get_norm(curr_vect[:2])) - np.arctan2(target_vect[2], get_norm(target_vect[:2])),
axis = np.array([-target_vect[1], target_vect[0], 0]),
)
self.shift(start - self.get_start())
return self

# Color functions
Expand Down

0 comments on commit 31119b6

Please sign in to comment.