增强现实演示
我正在尝试构建一个增强现实演示,例如这个 iPhone 应用程序: http://www.acrossair.com/acrossair_app_augmented_reality_nearesttube_london_for_iPhone_3GS.htm
但是我的几何/数学有点如今生锈了。
这就是我所知道的:
如果我的 Android 手机处于横向模式(主页按钮位于左侧),我的 z 轴指向我正在看的方向。
从我手机的传感器我知道我的 z 轴与北轴的角度是多少,我们称之为角度 theta。
如果我有一个从当前位置到我想要在屏幕上显示的点的向量,我可以计算该向量与 z 轴的角度。我们将这个角度称为 alpha。
因此,根据 alpha 角度,我可以感知该点的位置,并且可以在屏幕上显示它(如最近的地铁应用程序)。
这是一个简单演示的基本理论(当然它与App没什么不同,但这是第一步)。
有人能给我一些关于这件事的线索吗?
[更新]
我发现这个非常有趣的示例,但是我需要在 xx 和 yy 轴上都有运动。有什么提示吗?
I'm trying to build an Augmented Reality Demonstration, like this iPhone App:
http://www.acrossair.com/acrossair_app_augmented_reality_nearesttube_london_for_iPhone_3GS.htm
However my geometry/math is a bit rusty nowadays.
This is what I know:
If i have my Android phone on the landscape mode (with the home button on the left), my z axis points to the direction I'm looking.
From the sensors of my phone i know what is the angle my z axis has with the North axis, let's call this angle theta.
If I have a vector from my current position to the point I want to show in my screen, i can calculate the angle this vector does with my z axis. Let's call this angle alpha.
So, based on the alpha angle I have a perception of where the point is, and I'm able to show it in the screen (like the Nearest Tube App).
This is the basic theory of a simple demonstration (of course it's nothing like the App, but it's the first step).
Can someone give me some lights on this matter?
[Update]
I've found this very interesting example, however I need to have the movement on both xx
and yy
axis. Any hints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基础知识很简单。您需要您的位置和您的命运之间的角度(反正切)以及航向(来自手机中的数字罗盘)。请参阅此答案:增强现实运动下面有一些您可以使用的objective-c代码如果您来自java,可以阅读。
The basics are easy. You need the angle between your location and your destiny (arctangent), and the heading (from the digital compass in your phone). See this answer: Augmented Reality movement There is some objective-c code down there that you can read if you come from java.
您想要的是 3d 空间填充曲线,例如希尔伯特曲线。这是一个超过 3 坐标的空间索引。它相当于八叉树。您想要将对象存储在该八叉树中,并对您用 iPhone 记录的坐标(可能是屏幕中心的固定坐标)进行深度搜索。八叉树在八个方向上连续细分空间,3d 空间填充曲线是穿过空间的哈密尔顿路径,类似于分形,但它与八叉树的区域明显不同。我使用 2d-hilbert-curve 来加速地理空间数据库中的搜索。也许你想先从这个开始?
What you want is a 3d-Space-Filling-Curve for example a hilbert-curve. That is a spatial index over 3 ccordinate. It is comparable to a octree. You want to store the object in that octree and do a depth-firat search on the coordinate you have recorded with your iphone as fixed coordinate probably the center of the screen. A octree subdivde the space continously in eigth directions and a 3d-Space-Filling-Curve is an hamiltonian path through the space which is like a fracta but it is clearly distinctable from the region of the octree. I use 2d-hilbert-curve to speed search in geospatial databases. Maybe you want to start with this first?