Java Angle Difference angleDiff360(final double angleOne, final double angleTwo)

Here you can find the source of angleDiff360(final double angleOne, final double angleTwo)

Description

angle Diff

License

Apache License

Parameter

Parameter Description
angleOne a parameter
angleTwo a parameter

Declaration

public static final double angleDiff360(final double angleOne, final double angleTwo) 

Method Source Code

//package com.java2s;
/*/*from  w ww.j  a v a  2s.  co  m*/
 * Copyright 2016 Langhammer, Tim | Earth >> Europe >> Potsdam |
 * {@literal @}<a href="mailto:tlhammer@mailbox.org" alt="email">mail</a> |
 * "Tolerance first".
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    /**
     *
     * @param angleOne
     * @param angleTwo
     * @return
     */
    public static final double angleDiff360(final double angleOne, final double angleTwo) {
        if (angleOne < 0D || angleOne > 360D) {
            throw new IllegalArgumentException(
                    "angle one ( " + angleOne + " ) is out of bounds, should be between 0 and 360");
        }
        if (angleTwo < 0D || angleTwo > 360D) {
            throw new IllegalArgumentException(
                    "angle one ( " + angleTwo + " ) is out of bounds, should be between 0 and 360");
        }
        final double temp = Math.abs(angleOne - angleTwo);
        return Math.min(temp, 360D - temp);
    }
}

Related

  1. angleDiff(double angle1, double angle2, boolean normalized)
  2. angleDiff(final double a1, final double a2)
  3. angleDiff(float a, float b)
  4. angleDiff(int ang1, int ang2)
  5. angleDiff(int angle1, int angle2)
  6. angleDiffAbs(double a, double b)
  7. angleDifference(double angle1, double angle2)
  8. angleDifference(final int alpha, final int beta)