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

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

      1. 如何计算斜边和方位

        时间:2023-09-01
          <tbody id='XlelB'></tbody>
        <tfoot id='XlelB'></tfoot>
        <i id='XlelB'><tr id='XlelB'><dt id='XlelB'><q id='XlelB'><span id='XlelB'><b id='XlelB'><form id='XlelB'><ins id='XlelB'></ins><ul id='XlelB'></ul><sub id='XlelB'></sub></form><legend id='XlelB'></legend><bdo id='XlelB'><pre id='XlelB'><center id='XlelB'></center></pre></bdo></b><th id='XlelB'></th></span></q></dt></tr></i><div id='XlelB'><tfoot id='XlelB'></tfoot><dl id='XlelB'><fieldset id='XlelB'></fieldset></dl></div>

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

          <bdo id='XlelB'></bdo><ul id='XlelB'></ul>
          <legend id='XlelB'><style id='XlelB'><dir id='XlelB'><q id='XlelB'></q></dir></style></legend>

                • 本文介绍了如何计算斜边和方位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在此链接从@DanS 获得了以下代码 如何显示-a-map-still-image-file-with-a-moving-current-location

                  I got the below code from @DanS at this link how-to-display-a-map-still-image-file-with-a-moving-current-location

                  onCurrentPosition(Location current){
                      double hypotenuse = upperLeft.distanceTo(current);
                      double bearing = upperLeft.bearingTo(current);
                      double currentDistanceX = Math.cos(bearing) * hypotenuse;
                      //                     "percentage to mark the position"
                      double currentPixelX = (currentDistanceX / upperLeft.distanceTo(lowerRight) * Math.cos(upperLeft.bearingTo(lowerRight))) * mapWidth;
                  
                      moveIndicatorX(currentPixelX);
                  }
                  

                  以下是值:

                  • 当前:41.850033,-87.65005229999997
                  • 左上:41.866514127810355,-87.6720142364502
                  • 右下:41.83397145565242,-87.62824058532715
                  • 地图宽度:512 x 512 像素

                  这是位置、斜边(距离)、方位角(方位角)的在线计算器

                  Here are the calculator online for Location, hypotenuse(Distance), bearing(Azimuths)

                  • 将 LatLng 转换为位置格式(例如 41° 51′ 59.45″ N 87° 40′ 19.25〃W)
                  • 计算距离&给定位置的方位角

                  我得到了以下结果:

                  • 斜边 = 2581
                  • 轴承 = 135.21
                  • currentDistanceX = -2562
                  • currentPixelX = 311.9

                  想请大家:

                  1. 确认我的计算结果是否正确.
                  2. 如何计算 currentPixelY(另一点)?

                  顺便说一句,我打算用它来计算给定现实生活 LatLng(current) 的位置,并与我的静止图像映射将静止图像的左上角和右下角结合到现实生活 LatLng 中.

                  By the way, I am planning to use that to compute the location of a given real life LatLng(current) against with my still image map which bonded the upperLeft and lowerRight corners of the still image into real life LatLng.

                  如果您想查看实际的 &预期的输出,并希望轻松了解整个情况.请参考此链接-> 如何将当前位置标记为静止图像地图

                  If you want to see the actual & expected output and want to easily understand the whole picture. Please refer to this link -> How to mark the current location into a still image map

                  推荐答案

                  这是我实际使用的代码,不是之前贴的伪代码:

                  This is the actual code I'm using, not pseudo code posted previously:

                  Location upperLeft = new Location("");
                  upperLeft.setLatitude(41.866514127810355);
                  upperLeft.setLongitude(-87.6720142364502);
                  Location lowerRight = new Location("");
                  lowerRight.setLatitude(41.83397145565242);
                  lowerRight.setLongitude(-87.62824058532715);
                  Location current = new Location("");
                  current.setLatitude(41.850033);
                  current.setLongitude(-87.65005229999997);
                  double hypotenuse = upperLeft.distanceTo(current);
                  double bearing = upperLeft.bearingTo(current);
                  double currentDistanceX = Math.cos(bearing * Math.PI / 180.0) * hypotenuse;
                  //                     "percentage to mark the position"
                  double totalHypotenuse = upperLeft.distanceTo(lowerRight);
                  double totalDistanceX = totalHypotenuse * Math.cos(upperLeft.bearingTo(lowerRight) * Math.PI / 180.0);
                  double currentPixelX = currentDistanceX / totalDistanceX * 512;
                  
                  System.out.println(currentPixelX); // 259.3345493341548
                  

                  您计算出来的答案看起来有点不对劲.要计算 Y 更改复制所有 X 标记的计算和变量以使用 Math.sin() 而不是 Math.cos().

                  Your calculated answer looks a bit off. To calculate Y change copy all the X marked calculations and variables to use Math.sin() instead of Math.cos().

                  这篇关于如何计算斜边和方位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何通过其 android id 获取 android 设备的位置 下一篇:将 Android 应用程序连接到 BlueMix 存储的 DB2 数据库

                  相关文章

                  最新文章

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

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

                      <bdo id='jBHL4'></bdo><ul id='jBHL4'></ul>
                  1. <tfoot id='jBHL4'></tfoot>