bisect Angle - Android java.lang

Android examples for java.lang:Math Trigonometric Function

Description

bisect Angle

Demo Code


//package com.java2s;

public class Main {
    public static double bisectAngle(double a, double b, double alpha) {
        return constrainAngle(a + angleDiff(a, b) * alpha);
    }// ww w  .jav a 2 s .  c om

    public static double constrainAngle(double x) {
        x = Math.IEEEremainder(x, 360);
        if (x < 0)
            x += 360;
        return x;
    }

    public static double angleDiff(double a, double b) {
        double dif = Math.IEEEremainder(b - a + 180, 360);
        if (dif < 0)
            dif += 360;
        return dif - 180;
    }
}

Related Tutorials