Android AR:在iPhone屏幕上绘制点(POI或标记)
在iPhone屏幕上绘制时,计算x坐标时出现问题。当点位于300米范围内时,我们会使所有感兴趣的点靠近,尽管实际上它们是分散的。我甚至将视口的宽度从0.5更改为0.17(以度为单位,将28.647889757转换为10.0).任何人都可以建议将每个兴趣点相对于实际位置正确放置 AR上计算点的标准方法(Mixare、ARToolkit)为 使用ARKit计算Android AR:在iPhone屏幕上绘制点(POI或标记),android,iphone,gis,augmented-reality,Android,Iphone,Gis,Augmented Reality,在iPhone屏幕上绘制时,计算x坐标时出现问题。当点位于300米范围内时,我们会使所有感兴趣的点靠近,尽管实际上它们是分散的。我甚至将视口的宽度从0.5更改为0.17(以度为单位,将28.647889757转换为10.0).任何人都可以建议将每个兴趣点相对于实际位置正确放置 AR上计算点的标准方法(Mixare、ARToolkit)为 使用ARKit计算 double pointAzimuth = coordinate.coordinateAzimuth; //our x numbers a
double pointAzimuth = coordinate.coordinateAzimuth;
//our x numbers are left based.
double leftAzimuth = self.currentCoordinate.coordinateAzimuth - VIEWPORT_WIDTH_RADIANS / 2.0;
if (leftAzimuth < 0.0) {
leftAzimuth = 2 * M_PI + leftAzimuth;
}
if (pointAzimuth < leftAzimuth) {
//it's past the 0 point.
point.x = ((2 * M_PI - leftAzimuth + pointAzimuth) / VIEWPORT_WIDTH_RADIANS) * 480.0;
} else {
point.x = ((pointAzimuth - leftAzimuth) / VIEWPORT_WIDTH_RADIANS) * 480.0;
}
双点方位角=坐标.coordinateAzimuth;
//我们的x号是左基的。
双左方位角=self.currentCoordination.coordinateAzimuth-视口宽度弧度/2.0;
如果(左方位角<0.0){
左方位角=2*M_π+左方位角;
}
if(点方位角<左方位角){
//已经过了0点了。
点x=((2*M_PI-左方位角+点方位角)/视口宽度×弧度)*480.0;
}否则{
点x=((点方位角-左方位角)/视口宽度/弧度)*480.0;
}
在Mixare中:
CGPoint point;
CGRect viewBounds = self.overlayView.bounds;
//NSLog(@"pointForCoordinate: viewBounds.size.width = %.3f, height = %.3f", viewBounds.size.width, viewBounds.size.height );
double currentAzimuth = self.currentCoordinate.coordinateAzimuth;
double pointAzimuth = coordinate.coordinateAzimuth;
//NSLog(@"pointForCoordinate: location = %@, pointAzimuth = %.3f, pointInclination = %.3f, currentAzimuth = %.3f", coordinate.coordinateTitle, point.x, point.y, radiansToDegrees(pointAzimuth), radiansToDegrees(currentAzimuth), radiansToDegrees(pointInclination) );
double deltaAzimuth = [self deltaAzimuthForCoordinate:coordinate];
BOOL isBetweenNorth = [self isNorthForCoordinate:coordinate];
//NSLog(@"pointForCoordinate: (1) currentAzimuth = %.3f, pointAzimuth = %.3f, isNorth = %d", radiansToDegrees(currentAzimuth), radiansToDegrees(pointAzimuth), isBetweenNorth );
// NSLog(@"pointForCoordinate: deltaAzimuth = %.3f", radiansToDegrees(deltaAzimuth));
//NSLog(@"pointForCoordinate: (2) currentAzimuth = %.3f, pointAzimuth = %.3f, isNorth = %d", radiansToDegrees(currentAzimuth), radiansToDegrees(pointAzimuth), isBetweenNorth );
if ((pointAzimuth > currentAzimuth && !isBetweenNorth) ||
(currentAzimuth > degreesToRadians(360-self.viewRange) &&
pointAzimuth < degreesToRadians(self.viewRange))) {
// Right side of Azimuth
point.x = (viewBounds.size.width / 2) + ((deltaAzimuth / degreesToRadians(1)) * 12);
} else {
// Left side of Azimuth
point.x = (viewBounds.size.width / 2) - ((deltaAzimuth / degreesToRadians(1)) * 12);
}
CGPoint;
CGRect viewBounds=self.overlayView.bounds;
//NSLog(@“pointForCoordinate:viewBounds.size.width=%.3f,height=%.3f”,viewBounds.size.width,viewBounds.size.height);
双电流方位角=self.currentCoordination.coordinateAzimuth;
双点方位角=坐标.coordinateAzimuth;
//NSLog(@“点坐标:位置=%@,点方位=%.3f,点倾角=%.3f,当前方位=%.3f”,坐标坐标,点x,点y,弧度度数(点方位角),弧度度数(当前方位角),弧度度数(点倾角));
双三角方位=[自三角方位力坐标:坐标];
BOOL isBetweenNorth=[self isNorthForCoordinate:coordinate];
//NSLog(@“PointFor坐标:(1)当前方位角=%.3f,点方位角=%.3f,isNorth=%d”,弧度度数(当前方位角),弧度度数(点方位角),介于North之间);
//NSLog(@“PointForCoordination:三角洲方位角=%.3f”,弧度角(三角洲方位角));
//NSLog(@“PointFor坐标:(2)当前方位角=%.3f,点方位角=%.3f,isNorth=%d”,弧度度数(当前方位角),弧度度数(点方位角),介于North之间);
如果((点方位角>当前方位角&&!介于北向之间)|
(当前方位角>度弧度(360自视距)和
点方位角<度弧度(自视距))){
//方位角右侧
点x=(viewBounds.size.width/2)+(三角洲方位角/度弧度(1))*12;
}否则{
//方位角左侧
点x=(viewBounds.size.width/2)-(三角洲方位角/度弧度(1))*12;
}