3b1b / 3b1b/manim

Triangles don't fit exactly inside square after rotation

Đang mở
#683 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
93.9k
Fork
7.7k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Steps to reproduce
1) Copy source code:
```
class Pythagoras(Scene):
def construct(self):
title = TextMobject("Pythagorean Theorem")
title.to_edge(UL)

pre_square = Polygon(
[-2, 2, 0],
[2, 2, 0],
[2, -2, 0],
[-2, -2, 0],
color=WHITE
)

self.wait()

square2 = Polygon(
[-1.41, 1.41, 0],
[1.41, 1.41, 0],
[1.41, -1.41, 0],
[-1.41, -1.41, 0]

)
square2.rotate(PI/6)

triangle1 = Polygon(
[-2, 2, 0],
[-2 + math.sqrt(6), 2, 0],
[-2, 2 - math.sqrt(2), 0],
color=YELLOW
)

triangle2 = Polygon(
[2, 2, 0],
[-2 + math.sqrt(6), 2, 0],
[2, 2 - math.sqrt(6), 0],
color=YELLOW
)

triangle3 = Polygon(
[2, 2 - math.sqrt(6), 0],
[2, -2, 0],
[2 - math.sqrt(6), -2, 0],
color=YELLOW
)

triangle4 = Polygon(
[-2, 2 - math.sqrt(2), 0],
[-2, -2, 0],
[2 - math.sqrt(6), -2, 0],
color=YELLOW
)

triangles = [triangle1, triangle2, triangle3, triangle4]
for triangle in triangles:
triangle.set_fill(YELLOW, 0.6)

self.play(Write(title), ShowCreation(pre_square), ShowCreation(triangle1), ShowCreation(triangle2), ShowCreation(triangle3), ShowCreation(triangle4))

self.wait()

group = VGroup(pre_square, triangle1, triangle2, triangle3, triangle4)

self.play(ApplyMethod(group.to_edge, LEFT, {"buff": 1.6}))
self.wait()

square3 = pre_square.copy()

self.play(ApplyMethod(square3.shift, RIGHT * 7))

triangle2.generate_target()
triangle2.target.shift(RIGHT * (7- math.sqrt(6)))

triangle1.generate_target()
triangle1.target = triangle2.target.copy().rotate(PI)

triangle3.generate_target()
triangle3.target.shift(RIGHT * 7)

triangle4.generate_target()
triangle4.target = triangle3.target.copy().rotate(PI)

self.play(MoveToTarget(triangle1.copy()), MoveToTarget(triangle2.copy()), MoveToTarget(triangle3.copy()), MoveToTarget(triangle4.copy()))

self.wait()
```
2) run manim on this scene with -ps.

Unexpected behaviour
See https://stackoverflow.com/questions/57467134/when-rotating-shapes-vertices-are-just-slightly-off

Environment
OS: Windows 10
Python: 3.7.3
manim: 9 August 2019

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.