From d061bafaa2a091efcb7e64e0e81cbf379a604219 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Fri, 14 Feb 2020 15:29:52 -0800 Subject: [PATCH] Add Point mobject --- manimlib/mobject/mobject.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index 342dd525..75a4d010 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -1175,3 +1175,29 @@ class Group(Mobject): raise Exception("All submobjects must be of type Mobject") Mobject.__init__(self, **kwargs) self.add(*mobjects) + + +class Point(Mobject): + CONFIG = { + "artificial_width": 1e-6, + "artificial_height": 1e-6, + } + + def __init__(self, location=ORIGIN, **kwargs): + Mobject.__init__(self, **kwargs) + self.set_location(location) + + def get_width(self): + return self.artificial_width + + def get_height(self): + return self.artificial_height + + def get_location(self): + return np.array(self.points[0]) + + def get_bounding_box_point(self, *args, **kwargs): + return self.get_location() + + def set_location(self, new_loc): + self.points = np.array(new_loc, ndmin=2)