我想从标记的世界坐标上获得摄影机(ArScene视图)上的角度(轴承)

时间:2019-02-01 15:42:38

标签: android arcore

我使用下面的函数从世界坐标获取角度(轴承)

/**
     * Bearing in degrees between two coordinates.
     * @param lat1
     * @param lon1
     * @param lat2
     * @param lon2
     * @return
     */
    public static double bearing(double lat1, double lon1, double lat2, double lon2){
        double longitude1 = lon1;
        double longitude2 = lon2;
        double latitude1 = Math.toRadians(lat1);
        double latitude2 = Math.toRadians(lat2);
        double longDiff = Math.toRadians(longitude2-longitude1);
        double y = Math.sin(longDiff)*Math.cos(latitude2);
        double x = Math.cos(latitude1)*Math.sin(latitude2)-Math.sin(latitude1)*Math.cos(latitude2)*Math.cos(longDiff);

        return (Math.toDegrees(Math.atan2(y, x))+360)%360;
    }

但是我没有在相机上得到确切的坐标。我在此功能中忘记了什么?

0 个答案:

没有答案