Here you can find the source of radianAdd(double a, double b)
Parameter | Description |
---|---|
a | a parameter |
b | a parameter |
public final static double radianAdd(double a, double b)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Serdar Ormanl?./* w w w . ja v a2s . c om*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v2.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Serdar Ormanl? - initial API and implementation ******************************************************************************/ public class Main { /** * Adding to radians for Motion library. Plus operator wont give true result * * @param a * @param b * @return a+b radians according to rule */ public final static double radianAdd(double a, double b) { double result = 0; result = a + b; if (result < -1 * Math.PI) { result %= Math.PI; result += Math.PI; } else if (result > Math.PI) { result %= Math.PI; result += (-1 * Math.PI); } return result; } }