Java Angle angleAdd(int i, final int i1)

Here you can find the source of angleAdd(int i, final int i1)

Description

Increments to angle (degrees), wrapping around if necessary

License

Open Source License

Parameter

Parameter Description
i the angle
i1 the value to increment

Return

angle, snapped if necessary

Declaration

public static int angleAdd(int i, final int i1) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* w w  w  .j  av a  2s. c om*/
     * Increments to angle (degrees), wrapping around if necessary
     *
     * @param i the angle
     * @param i1 the value to increment
     * @return angle, snapped if necessary
     */
    public static int angleAdd(int i, final int i1) {
        i += i1;
        while (i >= 360) {
            i -= 360;
        }
        while (i < 0) {
            i += 360;
        }
        return i;
    }
}

Related

  1. angle(float x, float y, float x1, float y1)
  2. angle(float x1, float y1, float x2, float y2)
  3. angle2degree(double angle)
  4. angle2pixels(double angle)
  5. angle360Limit(float angle)
  6. angleDistance(double angle1, double angle2)
  7. angleEquals(double angle1, double angle2, double epsilon)
  8. AngleEvaluation(double angle, int effectIndex, int angleNeeded, int orbValue)
  9. angleFromDirection(float dirX, float dirY)