Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added abbreviated names for number_to_point and point_to_number

Grant Sanderson644ac5c94a1a
diff --git a/manimlib/mobject/coordinate_systems.py b/manimlib/mobject/coordinate_systems.py
index 754243648..bddf3548f 100644
--- a/manimlib/mobject/coordinate_systems.py
+++ b/manimlib/mobject/coordinate_systems.py
@@ -34,6 +34,14 @@ class CoordinateSystem():
def point_to_coords(self, point):
raise Exception("Not implemented")
+ def c2p(self, *coords):
+ """Abbreviation for coords_to_point"""
+ return self.coords_to_point(*coords)
+
+ def p2c(self, point):
+ """Abbreviation for point_to_coords"""
+ return self.point_to_coords(point)
+
def get_axes(self):
raise Exception("Not implemented")
diff --git a/manimlib/mobject/number_line.py b/manimlib/mobject/number_line.py
index 365cecccf..5e662d3a0 100644
--- a/manimlib/mobject/number_line.py
+++ b/manimlib/mobject/number_line.py
@@ -122,6 +122,14 @@ class NumberLine(Line):
)
return interpolate(self.x_min, self.x_max, proportion)
+ def n2p(self, number):
+ """Abbreviation for number_to_point"""
+ return self.number_to_point(number)
+
+ def p2n(self, point):
+ """Abbreviation for point_to_number"""
+ return self.point_to_number(point)
+
def get_unit_size(self):
return (self.x_max - self.x_min) / self.get_length()