Rotate angle by PI radians. - Java java.lang

Java examples for java.lang:Math Geometry

Description

Rotate angle by PI radians.

Demo Code

/**//  w  w w  . j  a va 2s.  c o m
 * Copyright 1998-2007, CHISEL Group, University of Victoria, Victoria, BC, Canada.
 * All rights reserved.
 */
//package com.java2s;

public class Main {
    /**
     * Rotate <code>angle</code> by PI radians.
     * @param angle a double value between PI and -PI
     * @return a double value between PI and -PI
     */
    public static double rotateByPI(double angle) {
        if (angle > 0.0d) {
            return (angle - Math.PI);
        }
        return (angle + Math.PI);
    }
}

Related Tutorials