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

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

        <tfoot id='p9AVK'></tfoot>

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

      1. 如何计算转弯方向

        时间:2023-08-28
      2. <small id='XC6tn'></small><noframes id='XC6tn'>

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

                  <bdo id='XC6tn'></bdo><ul id='XC6tn'></ul>

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

                  问题描述

                  我有一个三个纬度坐标,它们组成两条线段 A 到 B 到 C.我还发现了一个函数,可以以 -180 到 180 的方式返回线段 A-B 或 B-C 的北向.但是,我无法确定汽车何时从 A 到达 B,应该右转还是左转继续前往 C.

                  I have a three lat-lon coordinates that make up two line segment A to B to C. I also found a function that can return north-bearing of a line segment A-B or B-C in -180 to 180 manner. However, I'm having trouble to determine when a car reaches from A to B, should it turn right or left to continue to C.

                  推荐答案

                  之前的答案是错误的.现在这是正确的

                  Previous answer was wrong. now this is the correct

                  public Direction GetDirection(Point a, Point b, Point c)
                  {
                      double theta1 = GetAngle(a, b); 
                      double theta2 = GetAngle(b, c);
                      double delta = NormalizeAngle(theta2 - theta1);
                  
                      if ( delta == 0 )
                          return Direction.Straight;
                      else if ( delta == Math.PI )
                          return Direction.Backwards;
                      else if ( delta < Math.PI )
                          return Direction.Left;
                      else return Direction.Right;
                  }
                  
                  private Double GetAngle(Point p1, Point p2)
                  {
                      Double angleFromXAxis = Math.Atan ((p2.Y - p1.Y ) / (p2.X - p1.X ) ); // where y = m * x + K
                      return  p2.X - p1.X < 0 ? m + Math.PI : m ); // The will go to the correct Quadrant
                  }
                  
                  private Double NormalizeAngle(Double angle)
                  {
                      return angle < 0 ? angle + 2 * Math.PI : angle; //This will make sure angle is [0..2PI]
                  }
                  

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

                  上一篇:WPF 的现代 UI-导航 下一篇:Windows Phone 8 页面之间的导航问题

                  相关文章

                  最新文章

                    <bdo id='rbfFz'></bdo><ul id='rbfFz'></ul>

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

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

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