Java Utililty Methods Angle

List of utility methods to do Angle

Description

The list of methods to do Angle are organized into topic(s).

Method

doubleangle2pixels(double angle)
Converts a value from visual angle to pixels on the standard display.
return viewingDistance * Math.tan(deg2rad(angle)) * pixelsPerInch;
floatangle360Limit(float angle)
angle Limit
while (angle >= 360f)
    angle -= 360f;
while (angle < 0)
    angle += 360f;
return angle;
intangleAdd(int i, final int i1)
Increments to angle (degrees), wrapping around if necessary
i += i1;
while (i >= 360) {
    i -= 360;
while (i < 0) {
    i += 360;
return i;
...
doubleangleDistance(double angle1, double angle2)
angle Distance
if (angle1 < angle2) {
    return angle2 - angle1;
} else {
    return ((Math.PI * 2) - angle1) + angle2;
booleanangleEquals(double angle1, double angle2, double epsilon)
angle Equals
return Math.abs(wrapAngle2Pi(angle1) - wrapAngle2Pi(angle2)) < epsilon
        || Math.abs(wrapAngle2Pi(angle1 + Math.PI) - wrapAngle2Pi(angle2 + Math.PI)) < epsilon;
doubleAngleEvaluation(double angle, int effectIndex, int angleNeeded, int orbValue)
Angle Evaluation
double angleDiference = angle - angleNeeded;
if (angleDiference < 0) {
    angleDiference = angleDiference * -1;
if (angleDiference <= orbValue) {
    double factor = ((orbValue - angleDiference) / orbValue);
    return_result = effectIndex * factor;
} else {
...
floatangleFromDirection(float dirX, float dirY)
angle From Direction
if (dirX == 0f) {
    return 0f;
float inv = dirY / dirX;
float ang = (float) Math.atan(inv);
if (dirX < 0) {
    ang += (float) Math.PI;
ang -= (float) Math.PI * 0.5f;
return ang;
doubleangleFromR(final double[][] R)
compute the angle of rotation from a rotation matrix.
assert cols(R) >= 3;
assert rows(R) >= 3;
final double tr = R[0][0] + R[1][1] + R[2][2];
final double theta = Math.acos((tr - 1.0) / 2.0);
return theta;
floatangleInDegrees(float ownerRotation, float x1, float y1, float x2, float y2)
angle In Degrees
return Math.abs(ownerRotation - angleInDegrees(x1, y1, x2, y2)) % 360;
floatangleInRadians(float originX, float originY, float targetX, float targetY)
angle In Radians
return (float) Math.atan2(targetY - originY, targetX - originX);