es.ucm.look.locationProvider
Class Util

java.lang.Object
  extended by es.ucm.look.locationProvider.Util

public class Util
extends java.lang.Object

INS utilities.


Constructor Summary
Util()
           
 
Method Summary
static float adjustAngle(float degrees)
          Adjust angle to be between 0 and 360 degrees
static boolean between(int x, int a, int b)
           
static float[] copyArray(float[] a)
           
static void copyArray(float[] a, float[] b)
           
static int[] copyArray(int[] a)
           
static void copyArray(int[] a, int[] b)
           
static float distance(double[] p1, double[] p2)
           
static float distance(double x1, double y1, double x2, double y2)
           
static float distance(float[] p1, float[] p2)
           
static float distance(float x1, float y1, float x2, float y2)
           
static float distance(int[] p1, int[] p2)
           
static float distance(int x1, int y1, int x2, int y2)
           
static int distancePointLine(int x, int y, int[] p1, int[] p2, int[] m)
           
static int getMax(int a, int b)
           
static int getMin(int a, int b)
           
static boolean[] highest(int[] a, int count)
          Return the number of count-highest elements of an array.
static boolean inside(int[] p, int left, int top, int right, int bottom)
           
static boolean inside(int x, int y, int left, int top, int right, int bottom)
           
static double magnitude(double x, double y)
           
static float magnitude(float[] v)
          Return the magnitude of the input vector, which is the squared root of the sum of squared value
static double square(double n)
           
static float square(float n)
           
static int square(int n)
           
static int[] translate(int[] p, int originX, int originY)
           
static int[] translate(int x, int y, int originX, int originY)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

adjustAngle

public static float adjustAngle(float degrees)
Adjust angle to be between 0 and 360 degrees

Parameters:
degrees -
Returns:
new angle

between

public static boolean between(int x,
                              int a,
                              int b)

copyArray

public static float[] copyArray(float[] a)

copyArray

public static void copyArray(float[] a,
                             float[] b)

copyArray

public static int[] copyArray(int[] a)

copyArray

public static void copyArray(int[] a,
                             int[] b)

distance

public static float distance(double[] p1,
                             double[] p2)

distance

public static float distance(double x1,
                             double y1,
                             double x2,
                             double y2)

distance

public static float distance(float[] p1,
                             float[] p2)

distance

public static float distance(float x1,
                             float y1,
                             float x2,
                             float y2)

distance

public static float distance(int[] p1,
                             int[] p2)

distance

public static float distance(int x1,
                             int y1,
                             int x2,
                             int y2)

distancePointLine

public static int distancePointLine(int x,
                                    int y,
                                    int[] p1,
                                    int[] p2,
                                    int[] m)

getMax

public static int getMax(int a,
                         int b)

getMin

public static int getMin(int a,
                         int b)

highest

public static boolean[] highest(int[] a,
                                int count)
Return the number of count-highest elements of an array. The returning array at position i in a is true only when a[i] is one of count-highest elements in a

Parameters:
a - The input array
count - The number of highest elements to find
Returns:
The boolean array indicating highest elements

inside

public static boolean inside(int[] p,
                             int left,
                             int top,
                             int right,
                             int bottom)

inside

public static boolean inside(int x,
                             int y,
                             int left,
                             int top,
                             int right,
                             int bottom)

magnitude

public static double magnitude(double x,
                               double y)

magnitude

public static float magnitude(float[] v)
Return the magnitude of the input vector, which is the squared root of the sum of squared value

Parameters:
v - The input vector
Returns:
The magnitude of the vector

square

public static double square(double n)

square

public static float square(float n)

square

public static int square(int n)

translate

public static int[] translate(int[] p,
                              int originX,
                              int originY)

translate

public static int[] translate(int x,
                              int y,
                              int originX,
                              int originY)