Manim方程转换
Manim社区v0.15.1
class Equation_Transformation_Bug(Scene):
def construct(self):
equation_1 = MathTex("w", "\\times","v", "=", "1")
equation_1.shift(UP*2).scale(2)
equation_2 = MathTex("v", "=", "w^{-1}")
equation_2.scale(2)
equation_3 = MathTex("w", "\\times","w^{-1}", "=", "1")
equation_3.shift(UP*2).scale(2)
self.play(Write(equation_1), Write(equation_2))
self.wait(2)
self.play(FadeOut(equation_1[2]))
self.play(*[
Transform(
equation_2.get_part_by_tex("w^{-1}"),
equation_3.get_part_by_tex("w^{-1}")
)
] + [
Transform(
equation_1.get_part_by_tex(tex),
equation_3.get_part_by_tex(tex)
)
for tex in ("w", "\\times","=", "1")
])
self.wait(1)
我试图从等式_2获取W^{ - 1}以飞向以前由equation_1占用的斑点,并转换为公式_3。 相反,来自公式的“ 1”,从等式_3转换为w^{ - 1}。 我不是要进行替换变换。
如何将方程式_1转换为公式_3并将w^{ - 1}移动到公式_1的“ v”的位置?
Manim Community v0.15.1
class Equation_Transformation_Bug(Scene):
def construct(self):
equation_1 = MathTex("w", "\\times","v", "=", "1")
equation_1.shift(UP*2).scale(2)
equation_2 = MathTex("v", "=", "w^{-1}")
equation_2.scale(2)
equation_3 = MathTex("w", "\\times","w^{-1}", "=", "1")
equation_3.shift(UP*2).scale(2)
self.play(Write(equation_1), Write(equation_2))
self.wait(2)
self.play(FadeOut(equation_1[2]))
self.play(*[
Transform(
equation_2.get_part_by_tex("w^{-1}"),
equation_3.get_part_by_tex("w^{-1}")
)
] + [
Transform(
equation_1.get_part_by_tex(tex),
equation_3.get_part_by_tex(tex)
)
for tex in ("w", "\\times","=", "1")
])
self.wait(1)
I'm trying to get the w^{-1} from equation_2 to fly into the spot formerly occupied by v of equation_1 and transform into equation_3.
The "1" from equation_1, instead, transforms into the w^{-1} from equation_3.
I'm not trying to do a replacement transform.
How do I transform equation_1 into equation_3 and move the w^{-1} in the spot occupied by "v" of equation_1?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种特殊情况下,使用
transform -matchingshapes
效果很好的方法:如果形状与不唯一匹配的形状,请查看
transform -matchingshapes
的实现,有一种方法来调整到底变成了什么。An approach using
TransformMatchingShapes
works reasonably well in this particular case:If you have shapes that would not match uniquely, take a look at the implementation of
TransformMatchingShapes
, there is a way to tweak what exactly gets transformed into what.