Sideway
output.to from Sideway
Draft for Information Only

Content

Mobject
 Boundary
  def get_points_defining_boundary(self)
  def get_boundary_point(self, direction)
  def get_start(self)
  def get_end(self)
  def get_start_and_end(self)
  def point_from_proportion(self, alpha)
   Example
    Code
    Output

Mobject

The defined boundary functions for Mobject in mobject.py
  • def get_points_defining_boundary(self)
  • def get_boundary_point(self, direction)
  • def get_start(self)
  • def get_end(self)
  • def get_start_and_end(self)
  • def point_from_proportion(self, alpha)

Boundary

def get_points_defining_boundary(self)

get_points_defining_boundary is used to get all points that defining the boundary of a Mobject

def get_boundary_point(self, direction)

get_boundary_point is used to get a boundary point of a Mobject with respect to the specified direction parameter, direction/

def get_start(self)

get_start is used to get the start boundary point of a Mobject.

def get_end(self)

get_end is used to get the end boundary point of a Mobject.

def get_start_and_end(self)

get_start_and_end is used to get both the start and end boundary point of a Mobject.

def point_from_proportion(self, alpha)

def point_from_proportion is used to get a boundary point of a Mobject with respect to the specified alpha paraemter, alpha.

Example

Code
# folder/file: tut/manim_mobject_func_boundary_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_boundary_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"polyc.get\_points\_defining\_boundary():\ ",re.sub("\s+","\ ",str(polyc.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\_boundary\_point(direction=[0,1,0]):\ ",re.sub("\s+","\ ",str(polyb.get_boundary_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\_start():\ ",re.sub("\s+","\ ",str(polyb.get_start()).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\_end():\ ",re.sub("\s+","\ ",str(polyb.get_end()).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\_start\_and\_end():\ ",re.sub("\s+","\ ",str(polyb.get_start_and_end()).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.point\_from\_proportion(0.77):\ ",re.sub("\s+","\ ",str(polyb.point_from_proportion(0.77)).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
image

©sideway

ID: 200202702 Last Updated: 2/27/2020 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019