Java Radian Calculation radiancheck(double x)

Here you can find the source of radiancheck(double x)

Description

Returns an angle between 0 and 2 pi

License

Open Source License

Parameter

Parameter Description
x double containing angle in radians

Return

an angle between 0 and 2 pi

Declaration


public static double radiancheck(double x) 

Method Source Code

//package com.java2s;

public class Main {
    /** 2*PI./*from  www . j a va 2  s .  co m*/
     */
    public final static double TWOPI = 2.0 * Math.acos(-1.0);

    /** Returns an angle between 0 and 2 pi
     * @param x double containing angle in radians
     * @return an angle between 0 and 2 pi
     */

    public static double radiancheck(double x) {
        x = Modulo(x, TWOPI);
        if (x < 0.0)
            x = x + TWOPI;
        return x;
    }

    /** Modulo function
     * @return the Modulo
     */
    public static double Modulo(double x, double y) {
        return y * Frac(x / y);
    }

    /** Fractional part of a number (y=x-[x])
     * @return fractional part of a number
     */
    public static double Frac(double x) {
        return x - Math.floor(x);
    }
}

Related

  1. radian2Angle(double radian)
  2. radianAdd(double a, double b)
  3. radians(double d)
  4. radians(double w)
  5. radiansToBrads(double angleRadians)
  6. radiansToRA(final double raRadians)