我应该如何编写物理模拟程序?

发布于 11-24 14:50 字数 243 浏览 3 评论 0原文

我正在尝试创建一个可用于编写模拟程序的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凉城2024-12-01 14:50:16

创建物理引擎很困难。 (非常难)。但它也可以很有趣。好吧,有趣的是“我为什么要这样对自己?”一种方式。

假设您对所涉及的数学有一定的掌握*,并且假设您对刚体动力学感兴趣,可以从一些经典参考文献开始:

这些都是很好的起点,将为您提供足够的挑战你。

您还可以查看 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.

请帮我爱他2024-12-01 14:50:16

要了解物理,您必须首先了解数学。尝试在不使用数学方程的情况下编写物理引擎就像制作没有配料的蛋糕一样。

整个职业生涯都是建立在创建物理引擎的基础上的,所以我的建议是要么使用现有的引擎,要么拿出你的书。

To understand physics, you must first understand maths. Attempting to write a physics engine without using mathematical equations is like making a cake without ingredients.

Entire careers are built on creating physics engines, so my advice is to either use an existing engine, or get your books out.

小猫一只2024-12-01 14:50:16

构建物理模拟器可能需要大量工作。二维比三维简单得多,所以也许您想从 2D 开始。您可能想从现有的包开始,例如 JBox2D。它具有约束求解器、摩擦力等。您可以在 JBox2D 之上构建或研究它的工作原理。

HTML5 版本提供在线演示:GWTBox2D

Building a physics simulator can be a lot of work. Two dimensions is considerably simpler than three, so maybe you want to start with 2D. You might want to begin with an existing package like JBox2D. It has a constraint solver, friction, etc. You can build on top of JBox2D or study how it works.

An HTML5 version is available with online demos: GWTBox2D

甲如呢乙后呢2024-12-01 14:50:16

有一个程序叫做 Easy Java Analogs
这正是你想要的!
您可以创建 Java 小程序并准备好许多可视对象。
您还可以编写java代码和子程序。

访问http://fem.um.es/Ejs/下载。

There is a program called Easy Java Simulations
that does exactly what you want!
You can create java applets and has many of the visual objects ready.
You can also write java code and subprograms.

visit http://fem.um.es/Ejs/ to download.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文