반응형
Vector Class
def get_vector_test(self):
plane = NumberPlane()
a = np.array([1,3,0])
b = np.array([2,2,0])
vector_a = Vector(a)
vector_b = Vector(b)
c = Arrow(a,b, buff=0)
vector_c = Vector(c.get_vector())
self.add(plane)
self.add(vector_a, vector_b, c)
self.play(ShowCreation(vector_c))
self.wait()
Line.get_unit_vector
Line.get_angle
class VectorTest(MovingCameraScene):
def construct(self):
self.get_angle_test()
def get_angle_test(self):
self.setup() #MovingCameraScene's setup
plane = NumberPlane()
a = np.array([1, 3, 0])
b = np.array([2, 2, 0])
vector_a = Vector(a)
vector_b = Vector(b)
c = Arrow(a, b, buff=0, color=RED)
vector_c = Vector(c.get_vector(), color=RED)
angle = c.get_angle()
arc = Arc(0, angle, radius=0.5)
angle_text = DecimalNumber(angle / DEGREES).next_to(arc,RIGHT)
#play
self.add(plane,c)
self.play(TransformFromCopy(c,vector_c))
self.play(
Succession(
ShowCreation(arc),
ShowCreation(angle_text),
),
)
self.play(self.camera_frame.scale, 0.7,)
self.wait(3)
TangentLine
circle = Circle()
t_line = TangentLine(circle,0)
self.add(circle)
self.add(t_line)
self.wait()
반응형
'Programming > Manim code' 카테고리의 다른 글
[022]Triangle/ArrowTip (0) | 2020.05.06 |
---|---|
[021]Polygon (0) | 2020.05.06 |
[019]Arrow/DoubleArrow (0) | 2020.05.06 |
[018]Line/DashedLine (0) | 2020.05.06 |
[016]Mobject Class Diagram (0) | 2020.05.06 |