Mobject
The defined boundary functions for
Mobject in mobject.py
- def get_critical_point(self, direction)
- def get_edge_center(self, direction)
- def get_corner(self, direction)
- def get_center(self)
- def get_top(self)
- def get_bottom(self)
- def get_right(self)
- def get_left(self)
- def get_zenith(self)
- def get_nadir(self)
Boundary
def get_critical_point(self, direction)
get_critical_point is used to get a critical point of a
Mobject with respect to the specified direction parameter, direction.
def get_edge_center(self, direction)
get_edge_center is used to get an edge center of a
Mobject with respect to the specified direction parameter, direction.
def get_corner(self, direction)
get_corner is used to get a corner of a
Mobject with respect to the specified direction parameter, direction.
def get_center(self)
get_center is used to get the center of a
Mobject.
def get_top(self)
get_top is used to used to get the top of a
Mobject.
def get_bottom(self)
get_bottom is used to used to get the bottom of a
Mobject.
def get_right(self)
get_right is used to used to get the right of a
Mobject.
def get_left(self)
get_left is used to used to get the left of a
Mobject.
def get_zenith(self)
get_zenith is used to used to get the zenith of a
Mobject.
def get_nadir(self)
get_nadir is used to used to get the nadir of a
Mobject.
Example
Code
# folder/file: tut/manim_mobject_func_points_001a.py
import re
from manimlib.scene.scene import Scene
from manimlib.mobject.geometry import Rectangle, Square, Circle, Line,RoundedRectangle
from manimlib.animation.creation import ShowCreation
from manimlib.mobject.svg.tex_mobject import TexMobject, TextMobject
from manimlib.animation.fading import FadeOut
from manimlib.animation.creation import Write
from manimlib.animation.transform import ApplyMethod, ApplyFunction
class manim_mobject_func_points_001a(Scene):
def construct(self):
linex=Line([2,2,0],[1,1,0],color="#88FF00")
polya= RoundedRectangle(width=2,height=2,corner_radius=0.5,stroke_width=0,fill_color="#FFFF00",fill_opacity=1)
polyb = Rectangle(width=2.5,height=1.5,stroke_width=15,color="#88FF00",fill_color="#FFFF00",fill_opacity=1)
polyc= Square(side_length=2,stroke_width=20,fill_color="#FF8800",fill_opacity=1).move_to([-3,-2,0])
polyd= Circle(arc_center=(-2,0.75,0),color="#888888")
polya.add(Rectangle(width=2,height=2,color="#77DDCC").move_to(polya))
polya.add(Rectangle(width=1,height=2.5,color="#77DDCC").move_to(polya))
polya.add(TextMobject("A").move_to(polya))
polye = Rectangle(width=1.25,height=3.75,color="#888888",fill_color="#333333",fill_opacity=1).move_to([-0.625,-1.125,0])
polyf= Rectangle(width=1,height=2,color="#888888").move_to([-2.5,-2,0])
polyb.add(polye)
self.play(ShowCreation(polyb),run_time=2)
self.wait()
self.play(ShowCreation(polyc),ShowCreation(polyf),run_time=2)
self.wait()
self.play(ShowCreation(polya.move_to(polyd)),ShowCreation(polyd),run_time=2)
self.wait()
self.add(TextMobject("B").move_to(polyb))
self.add(TextMobject("C").move_to(polyc))
self.add(TextMobject("E").move_to(polye))
self.add(linex)
self.add(Rectangle(width=14.22,height=8))
text=TexMobject(r"polyb.get\_points\_defining\_boundary():\ ",re.sub("\s+","\ ",str(polyb.get_points_defining_boundary())).replace("[-","\cr[-")).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polye.get\_points\_defining\_boundary():\ ",re.sub("\s+","\ ",str(polye.get_points_defining_boundary())).replace("[","\cr[")).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_critical\_point(direction=[0,1,0]):\ ",re.sub("\s+","\ ",str(polyb.get_critical_point(direction=[0,1,0])).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_edge\_center(direction=[0,1,0]):\ ",re.sub("\s+","\ ",str(polyb.get_edge_center(direction=[0,1,0])).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_corner(direction=[1,1,0]):\ ",re.sub("\s+","\ ",str(polyb.get_corner(direction=[1,1,0])).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_center():\ ",re.sub("\s+","\ ",str(polyb.get_center()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_top():\ ",re.sub("\s+","\ ",str(polyb.get_top()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_bottom():\ ",re.sub("\s+","\ ",str(polyb.get_bottom()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_right():\ ",re.sub("\s+","\ ",str(polyb.get_right()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_left():\ ",re.sub("\s+","\ ",str(polyb.get_left()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_zenith():\ ",re.sub("\s+","\ ",str(polyb.get_zenith()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
text=TexMobject(r"polyb.get\_nadir():\ ",re.sub("\s+","\ ",str(polyb.get_nadir()).replace("[","\cr["))).move_to([0,3,0])
self.play(Write(text.shift_onto_screen()),run_time=3)
self.wait()
self.play(FadeOut(text),run_time=2)
Output