久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='TbIOM'></small><noframes id='TbIOM'>

    • <bdo id='TbIOM'></bdo><ul id='TbIOM'></ul>

    <i id='TbIOM'><tr id='TbIOM'><dt id='TbIOM'><q id='TbIOM'><span id='TbIOM'><b id='TbIOM'><form id='TbIOM'><ins id='TbIOM'></ins><ul id='TbIOM'></ul><sub id='TbIOM'></sub></form><legend id='TbIOM'></legend><bdo id='TbIOM'><pre id='TbIOM'><center id='TbIOM'></center></pre></bdo></b><th id='TbIOM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TbIOM'><tfoot id='TbIOM'></tfoot><dl id='TbIOM'><fieldset id='TbIOM'></fieldset></dl></div>

    <legend id='TbIOM'><style id='TbIOM'><dir id='TbIOM'><q id='TbIOM'></q></dir></style></legend>

        <tfoot id='TbIOM'></tfoot>

        計算兩個位置之間的方位角(緯度、經度)

        Calculate bearing between two locations (lat, long)(計算兩個位置之間的方位角(緯度、經度))
          <tbody id='FEvaJ'></tbody>

          1. <small id='FEvaJ'></small><noframes id='FEvaJ'>

            • <legend id='FEvaJ'><style id='FEvaJ'><dir id='FEvaJ'><q id='FEvaJ'></q></dir></style></legend>
                <bdo id='FEvaJ'></bdo><ul id='FEvaJ'></ul>
                  <i id='FEvaJ'><tr id='FEvaJ'><dt id='FEvaJ'><q id='FEvaJ'><span id='FEvaJ'><b id='FEvaJ'><form id='FEvaJ'><ins id='FEvaJ'></ins><ul id='FEvaJ'></ul><sub id='FEvaJ'></sub></form><legend id='FEvaJ'></legend><bdo id='FEvaJ'><pre id='FEvaJ'><center id='FEvaJ'></center></pre></bdo></b><th id='FEvaJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FEvaJ'><tfoot id='FEvaJ'></tfoot><dl id='FEvaJ'><fieldset id='FEvaJ'></fieldset></dl></div>

                • <tfoot id='FEvaJ'></tfoot>
                • 本文介紹了計算兩個位置之間的方位角(緯度、經度)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試開發自己的增強現實引擎.

                  在互聯網上搜索,我發現這個有用的還有另一種獲取beta的實現方式:

                  - (float)angleFromCoordinate:(CLLocationCoordinate2D)first toCoordinate:(CLLocationCoordinate2D)second {浮動縱向差異 = second.longitude - first.longitude;float latitudinalDifference = second.latitude - first.latitude;浮動可能方位角 = (M_PI * .5f) - atan(latitudinalDifference/longitudinalDifference);if (longitudinalDifference > 0)返回可能的方位角;else if (longitudinalDifference < 0)返回可能的方位角 + M_PI;else if (latitudinalDifference < 0)返回 M_PI;返回 0.0f;}

                  它使用這個公式:

                  float possibleAzimuth = (M_PI * .5f) - atan(latitudinalDifference/longitudinalDifference);

                  為什么 (M_PI * .5f) 在這個公式中?沒看懂.

                  繼續搜索,我發現另一個頁面在談論如何計算2個位置的距離和方位.在此頁面中還有另一個實現:

                  /*** 返回從該點到提供點的(初始)方位角,以度為單位* 見 http://williams.best.vwh.net/avform.htm#Crs** @param {LatLon} 點:目標點的緯度/經度* @returns {Number} 初始方位角(以度數為單位)*/LatLon.prototype.bearingTo = 函數(點){var lat1 = this._lat.toRad(), lat2 = point._lat.toRad();var dLon = (point._lon-this._lon).toRad();var y = Math.sin(dLon) * Math.cos(lat2);var x = Math.cos(lat1)*Math.sin(lat2) -Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);var brng = Math.atan2(y, x);返回 (brng.toDeg()+360) % 360;}

                  哪個是正確的?

                  解決方案

                  計算方位

                  //來源JSONObject 源 = step.getJSONObject("start_location");雙 lat1 = Double.parseDouble(source.getString("lat"));雙 lng1 = Double.parseDouble(source.getString("lng"));//目的地JSONObject 目的地 = step.getJSONObject("end_location");雙 lat2 = Double.parseDouble(destination.getString("lat"));雙 lng2 = Double.parseDouble(destination.getString("lng"));雙 dLon = (lng2-lng1);雙 y = Math.sin(dLon) * Math.cos(lat2);雙倍 x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);雙 brng = Math.toDegrees((Math.atan2(y, x)));brng = (360 - ((brng + 360) % 360));

                  將度數轉換為弧度

                  弧度 = 度數 * PI/180

                  將弧度轉換為度數

                  度數 = 弧度 * 180/PI

                  I'm trying to develop my own augmented reality engine.

                  Searching on internet, I've found this useful tutorial. Reading it I see that the important thing is bearing between user location, point location and north.

                  The following picture is from that tutorial.

                  Following it, I wrote an Objective-C method to obtain beta:

                  + (float) calculateBetaFrom:(CLLocationCoordinate2D)user to:(CLLocationCoordinate2D)destination
                  {
                      double beta = 0;
                      double a, b = 0;
                  
                      a = destination.latitude - user.latitude;
                      b = destination.longitude - user.longitude;
                  
                      beta = atan2(a, b) * 180.0 / M_PI;
                      if (beta < 0.0)
                          beta += 360.0;
                      else if (beta > 360.0)
                          beta -= 360;
                  
                      return beta;
                  }
                  

                  But, when I try it, it doesn't work very well.

                  So, I checked iPhone AR Toolkit, to see how it works (I've been working with this toolkit, but it is so big for me).

                  And, in ARGeoCoordinate.m there is another implementation of how to obtain beta:

                  - (float)angleFromCoordinate:(CLLocationCoordinate2D)first toCoordinate:(CLLocationCoordinate2D)second {
                  
                      float longitudinalDifference    = second.longitude - first.longitude;
                      float latitudinalDifference     = second.latitude  - first.latitude;
                      float possibleAzimuth           = (M_PI * .5f) - atan(latitudinalDifference / longitudinalDifference);
                  
                      if (longitudinalDifference > 0) 
                          return possibleAzimuth;
                      else if (longitudinalDifference < 0) 
                          return possibleAzimuth + M_PI;
                      else if (latitudinalDifference < 0) 
                          return M_PI;
                  
                      return 0.0f;
                  }
                  

                  It uses this formula:

                  float possibleAzimuth = (M_PI * .5f) - atan(latitudinalDifference / longitudinalDifference);
                  

                  Why is (M_PI * .5f) in this formula? I don't understand it.

                  And continue searching, I've found another page talking about how to calculate distance and bearing of 2 locations. In this page there is another implementation:

                  /**
                   * Returns the (initial) bearing from this point to the supplied point, in degrees
                   *   see http://williams.best.vwh.net/avform.htm#Crs
                   *
                   * @param   {LatLon} point: Latitude/longitude of destination point
                   * @returns {Number} Initial bearing in degrees from North
                   */
                  LatLon.prototype.bearingTo = function(point) {
                    var lat1 = this._lat.toRad(), lat2 = point._lat.toRad();
                    var dLon = (point._lon-this._lon).toRad();
                  
                    var y = Math.sin(dLon) * Math.cos(lat2);
                    var x = Math.cos(lat1)*Math.sin(lat2) -
                            Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);
                    var brng = Math.atan2(y, x);
                  
                    return (brng.toDeg()+360) % 360;
                  }
                  

                  Which one is the right one?

                  解決方案

                  Calculate bearing

                  //Source
                  JSONObject source = step.getJSONObject("start_location");
                  double lat1 = Double.parseDouble(source.getString("lat"));
                  double lng1 = Double.parseDouble(source.getString("lng"));
                  
                  // destination
                  JSONObject destination = step.getJSONObject("end_location");
                  double lat2 = Double.parseDouble(destination.getString("lat"));
                  double lng2 = Double.parseDouble(destination.getString("lng"));
                  
                  double dLon = (lng2-lng1);
                  double y = Math.sin(dLon) * Math.cos(lat2);
                  double x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);
                  double brng = Math.toDegrees((Math.atan2(y, x)));
                  brng = (360 - ((brng + 360) % 360));
                  

                  Convert Degrees into Radians

                  Radians = Degrees * PI / 180
                  

                  Convert Radians into Degrees

                  Degrees = Radians * 180 / PI
                  

                  這篇關于計算兩個位置之間的方位角(緯度、經度)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經度計算 X 和 Y)
                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  CLLocation returning negative speed(CLLocation 返回負速度)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)

                        <small id='Qh7IR'></small><noframes id='Qh7IR'>

                        <i id='Qh7IR'><tr id='Qh7IR'><dt id='Qh7IR'><q id='Qh7IR'><span id='Qh7IR'><b id='Qh7IR'><form id='Qh7IR'><ins id='Qh7IR'></ins><ul id='Qh7IR'></ul><sub id='Qh7IR'></sub></form><legend id='Qh7IR'></legend><bdo id='Qh7IR'><pre id='Qh7IR'><center id='Qh7IR'></center></pre></bdo></b><th id='Qh7IR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qh7IR'><tfoot id='Qh7IR'></tfoot><dl id='Qh7IR'><fieldset id='Qh7IR'></fieldset></dl></div>

                        <tfoot id='Qh7IR'></tfoot>
                            <tbody id='Qh7IR'></tbody>

                            <bdo id='Qh7IR'></bdo><ul id='Qh7IR'></ul>
                          • <legend id='Qh7IR'><style id='Qh7IR'><dir id='Qh7IR'><q id='Qh7IR'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 日本中文字幕日韩精品免费 | 亚洲视频一区在线观看 | www.嫩草| 日本精品一区二区三区在线观看视频 | 国产99久久精品一区二区永久免费 | 久久久久久高清 | 欧美日韩亚洲系列 | 亚洲成人av在线 | 偷拍自拍在线观看 | 亚洲不卡一 | 欧美日韩精品一区 | 国内自拍视频在线观看 | 日本免费一区二区三区四区 | 欧美亚洲另类丝袜综合网动图 | 视频第一区 | 国产成人精品一区二 | 久久精品久久久久久 | 久久久免费电影 | 国产色婷婷精品综合在线手机播放 | 二区欧美 | jizjizjiz中国护士18 | 成人在线精品 | 久久com | 2018中文字幕第一页 | 亚洲精品第一 | 成人在线一级片 | 成人免费视频网址 | 国产精品日韩欧美一区二区三区 | 久久久www成人免费精品张筱雨 | 国产一区二区免费在线 | 久久黄视频 | 91精品国产91久久久久久最新 | 天天天操天天天干 | 国产高清视频一区 | 国产一区h | 欧美日韩亚洲一区二区 | 中文字幕一页二页 | 99re超碰| 国产精品无码久久久久 | 美女中文字幕视频 | 日韩国产专区 |