我应该如何编写物理模拟程序?
我正在尝试创建一个可用于编写模拟程序的Java包。 我的目标是创建像弹簧这样的“物体”或像立方体和球体这样的固体物体。它们具有质量、速度、重力等,并且它们可以相互作用。
我在 www.myphysicalslab.com 上看到了一些模拟程序,但我的问题是我不想编写不同的程序不同场景的方程。有什么办法可以做到这一点吗?我是编程新手。
I am trying to create a Java package that can be used to write simulation programs.
My goal is to create 'objects' like springs or solid objects like cubes and spheres. They will have mass, velocity, gravity etc. and they can interact with each other.
I have seen some simulation programs on www.myphysicslab.com but my problem is that I don't want to write different equations for different senarios. Is there any way to do this? I am new to programming.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(4)
甲如呢乙后呢2024-12-01 14:50:16
有一个程序叫做 Easy Java Analogs
这正是你想要的!
您可以创建 Java 小程序并准备好许多可视对象。
您还可以编写java代码和子程序。
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
创建物理引擎很困难。 (非常难)。但它也可以很有趣。好吧,有趣的是“我为什么要这样对自己?”一种方式。
假设您对所涉及的数学有一定的掌握*,并且假设您对刚体动力学感兴趣,可以从一些经典参考文献开始:
这些都是很好的起点,将为您提供足够的挑战你。
您还可以查看 Erin Catto 的 Box2D 及其相关的 GDC 教程,您可以下载。
如需更具体的帮助,Bullet 论坛还包含一个小部分,您可以在其中讨论和提问一次您已经了解了一些基础知识。
*如果你没有这种公平的把握,那就学习吧。如果您不愿意,请不要尝试仅使用现有的引擎。如果这是您第一次编程体验,请先专注于编程。不要让自己不知所措。
祝你好运。
Creating a physics engine is hard. (Very hard). But it can also be a lot of fun. Well, fun in a "why am I doing this to myself?" kind of way.
Assuming your have a fair grasp of the maths involved*, and assuming you're interested in Rigid Body Dynamics there are a couple of classic references to start with:
Those are good places to start and will provide more than enough of a challenge for you.
You could also look at Box2D by Erin Catto and his associated GDC tutorials which you can download.
For more specific help, the forums for Bullet also contain a sub-section where you can discuss and ask questions once you have understood some of the basics.
*If you don't have this fair grasp, learn. If you're not willing to, don't try and just use an existing engine. If this is your very first programming experience, just focus on the programming first. Don't get yourself overwhelmed.
Good luck.