Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added c2p and p2c abbreviations to Axes

Grant Sanderson828c3dcd7a2a
diff --git a/manimlib/mobject/coordinate_systems.py b/manimlib/mobject/coordinate_systems.py
index bddf3548f..177d63459 100644
--- a/manimlib/mobject/coordinate_systems.py
+++ b/manimlib/mobject/coordinate_systems.py
@@ -171,12 +171,18 @@ class Axes(VGroup, CoordinateSystem):
result += (axis.number_to_point(coord) - origin)
return result
+ def c2p(self, *coords):
+ return self.coords_to_point(*coords)
+
def point_to_coords(self, point):
return tuple([
axis.point_to_number(point)
for axis in self.get_axes()
])
+ def p2c(self, point):
+ return self.point_to_coords(point)
+
def get_axes(self):
return self.axes