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

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

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

      1. 如何计算两个角度测量值的差异?

        How do I calculate the difference of two angle measures?(如何计算两个角度测量值的差异?)

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

            <tbody id='wHj24'></tbody>
          <legend id='wHj24'><style id='wHj24'><dir id='wHj24'><q id='wHj24'></q></dir></style></legend>

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

            • <bdo id='wHj24'></bdo><ul id='wHj24'></ul>
              <tfoot id='wHj24'></tfoot>

                1. 本文介绍了如何计算两个角度测量值的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在 Java 中计算两个角度测量值的差异(以度为单位),使结果在 [0°, 180°] 范围内?

                  How can I calculate the difference of two angle measures (given in degrees) in Java so the result is in the range [0°, 180°]?

                  例如:

                  350° to 15° = 25°
                  250° to 190° = 60°
                  

                  推荐答案

                      /**
                       * Shortest distance (angular) between two angles.
                       * It will be in range [0, 180].
                       */
                      public static int distance(int alpha, int beta) {
                          int phi = Math.abs(beta - alpha) % 360;       // This is either the distance or 360 - distance
                          int distance = phi > 180 ? 360 - phi : phi;
                          return distance;
                      }
                  

                  这篇关于如何计算两个角度测量值的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How can I detect integer overflow on 32 bits int?(如何检测 32 位 int 上的整数溢出?)
                  Local variables before return statements, does it matter?(return 语句之前的局部变量,这有关系吗?)
                  How to convert Integer to int?(如何将整数转换为整数?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在给定范围内创建一个随机打乱数字的 int 数组)
                  Inconsistent behavior on java#39;s ==(java的行为不一致==)
                  Why is Java able to store 0xff000000 as an int?(为什么 Java 能够将 0xff000000 存储为 int?)
                2. <legend id='kJg7I'><style id='kJg7I'><dir id='kJg7I'><q id='kJg7I'></q></dir></style></legend>

                  • <small id='kJg7I'></small><noframes id='kJg7I'>

                        <tbody id='kJg7I'></tbody>

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