问题标签 [acceleration]

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 投票
2 回答
526 浏览

c# - Deceleration not working as intended

I asked a similar question a few hours ago, but I think there was too much information in that question so I deleted that one and made this one more relevant.

I'm trying to move an object with a decreasing acceleration in a specified time but the acceleration reaches 0 before the object reaches the destination.

I calculate acceleration like this:

Acceleration will be a value between 0 and 2 depending on how much time has elapsed. The value will be closer to 2 when elapsed is closer to (total) duration.

So to calculate a deceleration I would do:

This appears to work just fine but the decelerating object never reaches the destination, at around 99% of the distance the elapsedTime becomes greater than total duration, causing the acceleration to become negative. In other words, it appears to have decelerated about 1% too fast.

The original acceleration works perfectly, so does the linear velocity. It's just the deceleration that isn't working properly.

Am I doing something wrong?

Thanks

0 投票
3 回答
4023 浏览

android - 禁用 mapView 的硬件加速会导致不断重绘

短版: 在 xml 中使用 android:hardwareAccelerated="false" 禁用硬件加速会将我的 Theme.Sherlock.Light.DarkActionBar 主题的背景颜色更改为更白的“白色”。 编辑:这曾经是主要问题。我更改了标题以强调第二个问题。

仅对 mapView 禁用硬件加速会导致不断重绘。

长版:

默认情况下,AFAIK 硬件加速在 API 级别 14 及更高级别上启用。(参考)

由于我正在构建和测试 API 级别 16,因此我的硬件加速通常是开启的,所以这就是我习惯看到的。主题是浅色但不是纯白色,它是浅灰色(默认)。

我在地图上绘制了一些圆形叠加层,当我放大关闭时,地图视图变得非常滞后,并且在 logcat 中出现“太大而无法渲染为纹理”的形状错误。我发现关闭硬件加速可以解决问题。

当我在 android 清单中为应用程序(或单个活动)关闭硬件加速时,我的布局的背景颜色会发生变化。它从浅灰色变为非常浅的灰色,几乎是纯白色。这是正常行为吗?

我尝试为地图视图关闭硬件加速:

这对于消除纹理过大的错误非常有效,因为地图视图没有硬件加速,并且它还使我的应用程序的其余部分硬件加速。这将是理想的解决方案。然而,这会导致另一个问题。它使我使用此代码的叠加层的 onDraw 方法不断被调用。即,onDraw 本身被一遍又一遍地调用,而不在 mapview 上调用 invalidate()。知道为什么会这样吗?

更新:

下面是一些简单的代码,当仅为mapView(我想要的)禁用硬件加速时,将重新创建常量重绘问题:

地图活动:

覆盖:

0 投票
0 回答
272 浏览

accelerometer - iPhone4S 和 iPhone5 上的加速度计行为不同?

我正在使用“UIAccelerationValue”将加速度计值记录到文件中。通过电子邮件发送文件后,将对记录的数据进行粗略的离线分析。这适用于最高 100Hz 的最大采样频率的 iPhone4S,并提供合理的结果。

最近我得到一个 iPhone5 用于测试目的,它表现出奇怪的行为。时间戳信息不是不断上升,并且远离两个测量点之间的恒定时间间隔。相比之下,iPhone4S 并非如此。此外,似乎加速度极限约为。iPhone5 为 8G,而 iPhone4S 为 2G。

似乎没有明显原因,iPhone5 的采样性能差异很大。

如何在 iPhone5 上解决这个问题?

0 投票
3 回答
5016 浏览

math - 结合 X 和 Y 加速度来计算合成角度和加速度

从 x 和 y 计算合成加速度。计算合成加速度的角度。

0 投票
1 回答
2254 浏览

c++ - 如何根据现有的加速度/速度规则计算所需的加速度

我有 3 个值来确定对象的运动:velocityaccelerationmaxVelocity。我还有一个distance值来确定它们与目标的接近程度(基本上是 X)。此代码运行每一帧以确定基于 3 个值的实际移动:

如果这velocityDelta有点令人困惑,那基本上是这样的:

现在,假设您只能更改 的值acceleration,有没有办法计算您需要的加速度以确保distance最终准确为 0?在运行上述代码的其中一个帧中的含义,distance - delta == 0. 所以假设代码如下所示:

你会投入什么价值acceleration来确保循环不会永远运行?假设距离/速度/最大值可以是您无法更改的任何数字。

0 投票
1 回答
1232 浏览

css - CSS剪辑使用gpu?

在我正在开发的一款 HTML5 游戏中,我在 CSS 动画中使用了 CSS 功能剪辑。但我意识到它会影响游戏的性能。

我猜clip没有使用gpu加速(如果我错了,请告诉我)。有没有一种方法可以实现与使用 GPU 加速的剪辑相同的效果?

这是我的简单动画:

提前致谢。

0 投票
0 回答
193 浏览

python - Euler - Van Wijngaarden 和 sumalt 变换与二元分裂相结合的性能

给定一个像二元分裂这样的加速结构,像 Euler-Wijngaarden 或 sumalt 这样的加速变换在与它并排使用时表现如何?

https://en.wikipedia.org/wiki/Van_Wijngaarden_transformation

据说 sumalt 估计比 Euler 方法快得多:

http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.em/1046889587
http://cestmal.in/Books/people.zoy.org/~sam/private/jnat/Programming/Algorithms %20For%20Programmers-%20Ideas%20And%20Source%20Code.pdf(第 19.2 节)

特别是,我们希望尽可能快地计算角度的余弦。

我有这个与 GMPY 和 mpmath 库配合良好的余弦二进制拆分结构:

我只想知道如果与 Euler 的/Van Wijngaarden 的/sumalt 转换一起使用,性能会得到什么提升,如果真的有收益的话。

我害怕编写不理想的代码,所以我还要求对某些方法进行有效的 python 实现。

0 投票
0 回答
148 浏览

c++ - 计算对象之间的新速度 (AABB)

最近我一直在尝试使用 Direct2D 在 C++ 中创建一个 2D 平台引擎。我目前遇到的问题是,在向它们施加重力等加速度后,让彼此靠在一起的物体正确交互。

现在我可以检测到碰撞并正确响应它们(我认为),当物体发生碰撞时,它们会记住它们靠在哪些其他物体上,因此物体可以被其他物体推动(请注意,在任何碰撞中都没有反弹,所以当物体发生碰撞时)碰撞他们保证会休息,直到发生其他事情)。每次模拟进行时,对象的加速度都会应用于它们的速度(例如 vx += ax * t,其中 t 是自上次进行以来经过的时间)。

在应用这些加速度之后,我想检查是否有任何相互靠着的物体以不同的速度移动(因为不同的物体可以有不同的加速度),并且根据这种差异,要么取消两个物体的链接,所以它们不是更长的休息时间,或者平衡它们的速度,以便它们再次以相同的速度移动。我无法创建一个可以跨许多静止对象执行此操作的算法。

这是帮助解释我的问题的图表

http://i.imgur.com/cYYsWdE.png

0 投票
1 回答
1109 浏览

java - Can't accelerate pixel-modified BufferedImages

For quite a long time, 1-2 months, I have been trying to find an answer to this particular problem:

I can't get my image hardware accelerated!

I've been searching on the net, created my own methods, hit my head with the keyboard (still feel the pain) but no success.

Although I hate libraries other than Java SDK, I tried LWJGL and JOGL but for some stupid reason they dont work on my computer.

I tried using System.setProperty("Dsun.java2d.opengl", "True"), I used VolatileImage but I can't draw individual pixels to it.(I tried using drawLine(x,y,x,y) but it's slow)

Now I am so desperate. I will do anything to fix this! So please, if you know the solution (I know some of you do) tell me so I can get rid of this.

My code:

I hope you understand the code. Please modify it in any way to help me find the solution to my problems.

Note: Please don't post anything about external libraries unless you are absolutely sure that I can't get this working without them.

Also, could it be that my graphics card doesn't support acceleration? (because I saw posts where hardware accel works for other people but not for me) Btw, it's a GeForce 430 GT.

THANKS IN ADVANCE!

0 投票
0 回答
170 浏览

android - 使用android设备对旋转矢量进行加速度补偿

我正在尝试使用带有传感器管理器的 TYPE_ROTATION_VECTOR 来获取安装在移动车辆上的 android 设备的倾斜度。

它工作正常,直到车辆突然加速或减速,它变得有点疯狂并给出错误的值。

有什么方法可以补偿加速度,或者有什么方法可以使用考虑了设备加速度的原始传感器数据来测量倾斜度?