mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
fix put_start_and_end_on
This commit is contained in:
parent
121e6215f8
commit
5c0a1e4b76
1 changed files with 5 additions and 3 deletions
|
@ -830,7 +830,6 @@ class Mobject(object):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def put_start_and_end_on(self, start, end):
|
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_start, curr_end = self.get_start_and_end()
|
||||||
curr_vect = curr_end - curr_start
|
curr_vect = curr_end - curr_start
|
||||||
if np.all(curr_vect == 0):
|
if np.all(curr_vect == 0):
|
||||||
|
@ -842,9 +841,12 @@ class Mobject(object):
|
||||||
)
|
)
|
||||||
self.rotate(
|
self.rotate(
|
||||||
angle_of_vector(target_vect) - angle_of_vector(curr_vect),
|
angle_of_vector(target_vect) - angle_of_vector(curr_vect),
|
||||||
about_point=curr_start
|
|
||||||
)
|
)
|
||||||
self.shift(start - curr_start)
|
self.rotate(
|
||||||
|
math.atan2(target_vect[2], np.sqrt(target_vect[0]**2 + target_vect[1]**2)) - math.atan2(curr_vect[2], np.sqrt(curr_vect[0]**2 + curr_vect[1]**2)),
|
||||||
|
axis = np.array([-target_vect[1], target_vect[0], 0]),
|
||||||
|
)
|
||||||
|
self.shift(start - self.get_start())
|
||||||
return self
|
return self
|
||||||
|
|
||||||
# Color functions
|
# Color functions
|
||||||
|
|
Loading…
Add table
Reference in a new issue