get Quadrant - Java java.lang

Java examples for java.lang:Math Curve

Description

get Quadrant

Demo Code


//package com.java2s;

public class Main {
    public static int getQuadrant(double angle) {
        return (int) (normalizeAngle(angle) / 90) % 4 + 1;
    }/*from  www. ja v  a2 s. c o  m*/

    public static double normalizeAngle(double angle) {
        double value = angle % 360;
        if (angle < 0)
            value = value + 360;

        return value;
    }
}

Related Tutorials