找到设置纬度和经度使用用户的当前的纬度,经度和观看的物体的方向经度、纬度、物体、方向

2023-09-06 00:41:21 作者:泛舟花海

我建立一个Android应用程序基于增强现实。其主要思想是,当用户打开了我的申请,在默认情况下设备的摄像头开始在preVIEW模式。基于用户的当前GPS位置,并且其中用户/摄像机面对我想计算它们的组的纬度和经度的范围内的方向θ

I am building an Android application based on Augmented Reality. The main idea is when user opens up my application, by default device's camera starts in preview mode. Based on user's current GPS location and the direction in which user/camera is facing I want to calculate which are the set of latitudes and longitudes in the range?

下面的图片说明了我的情况非常好。我有全套的经度和纬度为所有的画黑点在图中。现在假设用户是在圆的中心。同时考虑到他正在查看北的方向。如果我们考虑到的45对北向度的角度。我想获得设定的纬度和经度这是即将在45度的可视区域。

Following image explains my scenario very well. I have full set of latitudes and longitudes as drawn all black spots in the figure. Now suppose user is at the center of the circle. Also considering that he is viewing in North direction. If we consider an angle of 45 degree towards North direction. I want to get set of latitudes and longitudes which are coming in this 45 degree viewable area.

我能得到哪些用户的摄像头的朝向。我也能够找到用户的当前GPS位置。我有全套存储在我的SQLite数据库的经度和纬度的。现在,我要计算的是一套纬度和中用户的设备摄像头正面临着经度。

I am able to get the direction in which user's camera is facing. I am also able to find user's current GPS location. I have full set of latitudes and longitudes stored in my SQLite database. Now I want to calculate is the set of latitudes and longitudes in which user's device camera is facing.

我希望我已经解释了pretty的好位置。它有点急事,如果有人能够帮助这一点。

I hope I have explained pretty well here. Its bit urgent if anyone can help on this.

在此先感谢。

推荐答案

要获得可视角度,可以作为近似使用Camera.Parameters getHorizo​​ntalViewAngle()方法。让我们把它叫做阿尔法。你也知道你的设备的轴承从它的角度去磁北,姑且称之为测试版。

To obtain the viewing angle, you can use as an approximation the Camera.Parameters getHorizontalViewAngle() method. Let's call it alpha. You also know the bearing of your device from its point of view to magnetic North, let's call it beta.

从那里,给定的范围内,遍历组数据库位置,计算轴承从你的位置,它,并检查它是否是区间内的β-α/ 2,β+α/ 2]

From there, within a given radius, iterate through set of database locations, compute the bearing from your position to its, and check if it is inside the interval [beta-alpha/2, beta+alpha/2]

如果你不是真的在赶成这样,我建议看看成 Mixare ,它的一个开源框架,其中涉及的位置和AR。

If you're not really on a rush into this, I would suggest to take a look into Mixare, its an open source framework which deals with location and AR.