行星的位置

发布于 2025-02-09 11:25:47 字数 533 浏览 4 评论 0原文

我想在Shadertoy中实现重力系统,而无需使用任何存储/缓冲区。因此,我无法保存任何变量,并且我的动画必须是时间的函数。是否有可能发挥时间来计算行星的当前位置?

我一点也感到困惑,因为下一个位置取决于当前的速度,而当前的速度取决于以前的加速度,这取决于以前的位置。理论上可以作为时间的函数实现吗?

更一般的问题是,这种半圆形关系可以成为常规函数吗?

“ https://wikimedia.org/api/rest_v1/media/media/math/math/render/svg/05b6d26ad3cf608398e3015f06af16af158ebefeebfeebfeeb6d

“ f(x)=?作为简单的表单

此函数具有上述问题,因为f(x)取决于函数的以前值。

请注意,行星不在圆形和稳定的轨道上。但是它们具有初始位置和速度。

I want to implement a gravity system in shadertoy without using any storage/buffer. So I can't save any variable and my animations must be a function of time. Is it possible to make a function of time to calculate the current position of the planet?!

I'm confused at all, because the next position depends on the current velocity and the current velocity depends on the former acceleration and that depends on former position. Is it theoretically implementable as a function of time?

The more general general question is that are can such semicircular relations be subject to be a regular function?

Initial values

Formulas
f(x)=? as simple form

This function has the above problem, because f(x) depends on the former values of the function.

Note that planets aren't located in circular and stable orbits. But they have initial position and velocity.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

记忆消瘦 2025-02-16 11:25:47

仅当您使用开普勒方程而不是重力模拟时,才有可能的时间函数……

仅当您具有稳定的轨道并注意这只是True轨迹的近似值时才可行。

请参阅相关:

您可以做一个混合方法在其中使用开普勒进行稳定轨道,一旦触发了相互作用(通过对象的紧密接近),您将转换回 gravity 模型,计算交互结果并转换回开普勒(我假设是那是 ksp 正在这样做)。

因此,您应该有一个开普勒轨迹的列表,其时间为每个身体的时间持续时间,然后将正确的轨迹用于查询时间...

因此,当将它们全部放在一起时,我将:

  1. 计算初始Kepler轨迹< /strong>

    因此,在单个轨道上计算点并从中获得轨道参数

  2. 计算关闭遇到

    因此,彼此接近尸体的时间(类似于椭圆的交集),请参见类似(但更容易)的问题:

    这也可能有助于椭圆相遇的计算:

  3. 重新计算重力模型并创建一个新的开普勒轨迹

    将其添加到遇到时间后有效的身体轨迹列表...

  4. 如果有任何相遇找到时间限制,转到#2

,如果您想知道身体在时间t,只需查看其Keplerian轨迹列表,使用具有其有效时间&gt; = t的一个,而有效时间也最小,只需计算您的位置,速度或任何您需要的内容...

A time function is possible only if you use Kepler's equation instead of a gravity simulation...

That is doable only if you have stable orbits and note it’s just approximation of the true trajectory.

See related:

You can do a hybrid approach where you use Kepler for stable orbits and once interaction is triggered (by close proximity of objects) you convert back to the gravity model, compute the interaction result and convert back to Kepler (I assume that is how KSP is doing it).

So you should have a list of Keplerian trajectories with their time duration for each body and then just use the correct one for queried time...

So when putting it all together, I would:

  1. compute initial Kepler trajectories

    so compute points on a single orbit and obtain orbital parameters from it

  2. compute close encounters

    so times when bodies are near each other (similar to intersection of ellipses) see similar (but easier) problem:

    Also this might greatly help with elliptic encounters computations:

  3. for each encounter recompute the gravity model and create a new Kepler trajectory

    Add it to list of body trajectories that will be valid after time of encounter...

  4. If any encounter up to some time limit found, go to #2

Now if you want to know where the body is at time t, just look to its list of Keplerian trajectories, use the one that has its valid time >= t while valid time is also smallest and just compute your position, speed or whatever you need...

吃颗糖壮壮胆 2025-02-16 11:25:47

即使在两体问题(牛顿引力)的情况下,您也无法将行星的位置表示为时间的简单分析功能,并且需要诉诸数值集成。

因此,我看不出在更普遍的情况下,您可以在不使用变量的情况下计算位置。

Even in the case of the two-body problem (Newtonian gravitation), you can't express the position of a planet as a simple analytical function of time and you need to resort to numerical integration.

So I don't see how in a more general case you could compute positions without using variables.

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