Java examples for 2D Graphics:Angle
simplify Angle
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { double angle = 2.45678; System.out.println(simplifyAngle(angle)); }/*from ww w .j ava 2 s . c o m*/ public static double simplifyAngle(double angle) { angle = angle % (2.0 * Math.PI); if (angle < -Math.PI) { return angle + 2 * Math.PI; } else if (angle > Math.PI) { return angle - 2 * Math.PI; } return angle; } }