Java Angle AngleEvaluation(double angle, int effectIndex, int angleNeeded, int orbValue)

Here you can find the source of AngleEvaluation(double angle, int effectIndex, int angleNeeded, int orbValue)

Description

Angle Evaluation

License

Open Source License

Declaration

public static double AngleEvaluation(double angle, int effectIndex, int angleNeeded, int orbValue) 

Method Source Code

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

public class Main {
    private static double return_result = 0;

    public static double AngleEvaluation(double angle, int effectIndex, int angleNeeded, int orbValue) {
        // compared relation angle with angled needed
        double angleDiference = angle - angleNeeded;
        //System.out.println(angleDiference);

        // to make future relations positive numbers are needed
        if (angleDiference < 0) {
            angleDiference = angleDiference * -1;
        }/*w  w w . j  a va  2  s. co  m*/
        // angle separation most be +- orb permision to qualify for relation effect
        if (angleDiference <= orbValue) {
            // factor based on how precice the relation is (how close to the perfect value)
            double factor = ((orbValue - angleDiference) / orbValue);

            // effectIndex is the value for a perfect angle match (maximum value), by multiplying it to the factor we mark down this effect value proportionally to how perfect it was.
            return_result = effectIndex * factor;
        } else {
            // if angle diference is off the orb persmision, the effect is neglected and asign a value of 0
            return_result = 0;
        }

        return return_result;
    }
}

Related

  1. angle2pixels(double angle)
  2. angle360Limit(float angle)
  3. angleAdd(int i, final int i1)
  4. angleDistance(double angle1, double angle2)
  5. angleEquals(double angle1, double angle2, double epsilon)
  6. angleFromDirection(float dirX, float dirY)
  7. angleFromR(final double[][] R)
  8. angleInDegrees(float ownerRotation, float x1, float y1, float x2, float y2)
  9. angleInRadians(float originX, float originY, float targetX, float targetY)