Skip to content

Commit

Permalink
Only call self.throw_error_if_no_points once for get_start_and_end
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Aug 22, 2021
1 parent f3e3a7c commit 7356a36
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 @@ -1088,14 +1088,16 @@ def get_z(self, direction=ORIGIN):

def get_start(self):
self.throw_error_if_no_points()
return np.array(self.get_points()[0])
return self.get_points()[0].copy()

def get_end(self):
self.throw_error_if_no_points()
return np.array(self.get_points()[-1])
return self.get_points()[-1].copy()

def get_start_and_end(self):
return self.get_start(), self.get_end()
self.throw_error_if_no_points()
points = self.get_points()
return (points[0].copy(), points[-1].copy())

def point_from_proportion(self, alpha):
points = self.get_points()
Expand Down

0 comments on commit 7356a36

Please sign in to comment.