问题标签 [physics]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
7795 浏览

iphone - iPhone流体模拟

有人知道 iPhone 的流体引擎吗?我需要水和气体模拟。

0 投票
2 回答
1757 浏览

actionscript-3 - Box2D中下落的物体应该由于质心而旋转?

我正在尝试在 Box2DAS3 中模拟下落的气球。重要的是,如果气球侧向撞击或以一定角度掉落,则气球会下落,以至于您将其吹起的底部会朝底部旋转。

替代文字 http://lh4.ggpht.com/_gjsCWAV_CZc/Sw7zqHahTJI/AAAAAAAAC3s/YIJka4AsM5s/s144/Untitled.jpg

我尝试过偏移身体的质心,并将两个身体连接在一起,其中较密的一个代表领带。在这两种情况下,身体都以相同的角度下落而不旋转。

0 投票
2 回答
927 浏览

xna - Farseer Physics XNA Geom“绊倒”

我有一个类似于http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=72364的问题

我有一个矩形播放器几何图形,许多矩形瓷砖几何图形彼此相邻排列。

有时,当玩家 geom 在它们之间穿过时,他似乎会夹到瓷砖 geom 的角落并因此旋转过来。

即使将惯性矩切换为防止旋转的无穷大,当它夹住边缘时,玩家 geom 也会“跳跃”。

这是 geoms绊倒图像的屏幕截图 http://notspike.com/PrototypeG/trip.png

有什么解决办法吗?我已经尝试过 Farseer 论坛,但它似乎很不活跃

这是一个使用圆形几何图形播放器的视频链接

http://www.notspike.com/PrototypeG/trip.avi

0 投票
4 回答
19831 浏览

java - Java中是否有可以进行集成的方法?

我正在用java编写一个模拟卡诺引擎的程序,我想计算完成的工作,我需要使用集成。我一直在谷歌上四处寻找,并没有找到我想要的东西,有什么建议吗?

0 投票
5 回答
10049 浏览

c# - 三角形 - 三角形相交测试

我想知道是否有一些教程或指南来理解和实现 3D 环境中的三角形-三角形相交测试。(我不需要知道交叉路口发生的确切位置,而只需知道发生了交叉路口)

我打算按照理论上的 pdf 来实现它,但我很困在

  1. 计算三角形 2 的平面方程。
  2. 如果三角形 1 的所有点都在同一侧,则拒绝为微不足道。
  3. 计算三角形 1 的平面方程。
  4. 如果三角形 2 的所有点都在同一侧,则拒绝为微不足道。
  5. 计算相交线并投影到最大轴上。
  6. 计算每个三角形的间隔。
  7. 相交区间。

本指南的第 5 点。我真的不知道在问什么(所有 5,6 和 7)。XD

由于我的数学知识不高(嗯,我知道大学的几门考试给了我(我是一个原始程序员 XD)),请尽量对我简单。:D (我试图在谷歌上搜索,但大多数链接指向一些 4-5 页的公式,我真的不想知道也不懂。)

谢谢您的帮助

0 投票
4 回答
4480 浏览

math - Collision Detection between Accelerating Spheres

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that I need help with is the math of the collision detection algorithm.

The iterative simulation of movement that I am using is basically as follows:

(Note: 3D Vectors are ALL CAPS.)

Where:

What I basically need to do is to find some efficient formula that derives from (EQ.2) above for two objects (obj1, obj2) and tell if they ever collide, and if so, at what time. I need the exact time both so that I can determine if it is in this particular time increment (because acceleration will be different at different time increments) and also so that I can locate the exact position (which I know how to do, given the time)

For this engine, I am modelling all objects as spheres, all this formula/algorithm needs to do is to figure out at what points:

where .Distance is a positive scalar value. (You can also square both sides if this is easier, to avoid the square root function implicit in the .Distance calculation).

(yes, I am aware of many, many other collision detection questions, however, their solutions all seem to be very particular to their engine and assumptions, and none appear to match my conditions: 3D, spheres, and acceleration applied within the simulation increments. Let me know if I am wrong.)


Some Clarifications:

1) It is not sufficient for me to check for Intersection of the two spheres before and after the time increment. In many cases their velocities and position changes will far exceed their radii.

2) RE: efficiency, I do not need help (at this point anyway) with respect to determine likely candidates for collisions, I think that I have that covered.


Another clarification, which seems to be coming up a lot:

3) My equation (EQ.2) of incremental movement is a quadratic equation that applies both Velocity and Acceleration:

In the physics engines that I have seen, (and certainly every game engine that I ever heard of) only linear equations of incremental movement that apply only Velocity:

This is why I cannot use the commonly published solutions for collision detection found on StackOverflow, on Wikipedia and all over the Web, such as finding the intersection/closest approach of two line segments. My simulation deals with variable accelerations that are fundamental to the results, so what I need is the intersection/closest approach of two parabolic segments.

0 投票
1 回答
90 浏览

algorithm - ePic - 与物理学有什么关系?

物理和技术有什么关系?我有兴趣学习这个 3d 照片查看器ePic中遵循的算法。

任何其他已知的物理引擎?

0 投票
2 回答
1841 浏览

artificial-intelligence - 需要帮助破译射弹运动的公式

我需要实现一点人工智能来弄清楚如何用弹丸运动击中目标。

我在维基百科上找到了这个:

击中坐标所需的角度

这看起来正是我需要的东西,特别是因为我在从零高度以上发射弹丸时遇到了额外的问题。然而,我的数学技能不是很好,所以这对我来说完全是一派胡言,我不知道如何将其中的任何一个翻译成代码。

如果有人能用基本运算符(+ - * %)和函数(sin、cos、sqrt 等)将其分解成我能理解的东西,我将不胜感激。

0 投票
4 回答
362 浏览

python - 天体动力学引擎的类或元类设计

那里的大师:

航天器运动建模的微分方程可以用一组加速度项来描述:

通常 a0 是物体的质点加速度 (a0 = -mu * r/r^3);“高阶”术语可能是由于其他行星、太阳辐射压力、推力等。

我正在实现一组旨在在这种系统上工作的算法。我将从 Python 开始进行设计和原型制作,然后我将转向 C++ 或 Fortran 95。

我想设计一个类(或元类),它允许我为给定实例指定不同的加速项,类似于:

在这种情况下,实例 S 将默认为,例如,两个加速项,我将添加我想要的其他两个项:some accelerationsome_other_acceleration; 他们返回一个向量(这里表示为一个三元组)。请注意,在我的“实现”中,我重载了+运算符。

这样,算法将为抽象的“航天器”设计,所有实际力场都将根据具体情况提供,使我能够使用简化模型、比较建模方法等。

你将如何实现一个类或元类来处理这个问题?

对于这个相当冗长且解释不清的问题,我深表歉意,但我的大脑有点模糊。

谢谢。

0 投票
2 回答
1831 浏览

cocos2d-iphone - 弹丸运动计算与花栗鼠动力学

我需要实现一点 Ai,它可以向刚体施加脉冲以击中目标。就像从大炮发射的炮弹一样。我正在使用 Chipmunk Dynamics 作为物理引擎。

我的数学很糟糕,我的物理也很糟糕,但我一直在阅读,在 SO 的帮助下,以及来自这个维基百科条目的以下内容,我得到了这个

这应该给我一个角度,我可以从中计算发射弹丸所需的水平和垂直速度。

但是,它不起作用,这并不让我感到惊讶,原因有很多。首先是因为我的数学和物理很差,但也因为我对其他几件事感到困惑。

  1. 这种方法似乎没有考虑质量。应该是?我会认为这很重要吗?但是后来,我在大学学习艺术,所以我可能错了。

  2. Box2d 有 PTM_RATIO,但我在花栗鼠中找不到类似的东西,那么我的值如何与花栗鼠中的空间坐标对应?

  3. 我知道弧度以及它们在度数上的差异,以及如何在两者之间进行转换。但是我应该在这里使用哪个?我应该将角度 1 和角度 2 转换为度数吗?即使我这样做了,它仍然不起作用。

总之,关于物理和花栗鼠的知识有很多我不明白的。所以我在这里,寻求帮助。

花栗鼠中有什么东西可以用来解决这个问题,或者如果有人不得不自己解决这个问题,我真的很感激一些帮助。