Triangles don't fit exactly inside square after rotation
- Vorherrschende Sprache
- Python
- Sterne
- 93.9k
- Forks
- 7.7k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.