javaclient2.extra
Class PositionGeometryTools

java.lang.Object
  extended by javaclient2.extra.PositionGeometryTools

public class PositionGeometryTools
extends java.lang.Object

Several methods for position geometric calculus.

Author:
Marius Borodi & Radu Bogdan Rusu

Constructor Summary
PositionGeometryTools()
           
 
Method Summary
static float calcAngle(java.awt.Point p1, java.awt.Point p2)
          Calculate the angle between the line determined by the two points and the horizontal axis.
static float calcDist(float x, float y)
          Calculate the distance between two X and Y points assuming that their counterparts are 0 using Pitagora's theorem.
static float calcDist(java.awt.Point p1, java.awt.Point p2)
          Calculate the distance between two points (p1 and p2).
static java.awt.Point calcDistPoint(java.awt.Point initP, float dist, float angle)
          Calculate the coordinates of a point situated at distance dist, angle angle from a given point initP.
static float calcX(java.awt.Point initP, float dist, float angle)
          Calculate the X coordinate of a point situated at distance dist, angle angle from a given point initP.
static float calcY(java.awt.Point initP, float dist, float angle)
          Calculate the Y coordinate of a point situated at distance dist, angle angle from a given point initP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositionGeometryTools

public PositionGeometryTools()
Method Detail

calcDist

public static float calcDist(float x,
                             float y)
Calculate the distance between two X and Y points assuming that their counterparts are 0 using Pitagora's theorem.

Parameters:
x - X's coordonate of the first point (Y=0)
y - Y's coordonate of the second point (X=0)
Returns:
distance between [X, 0] and [0, Y] as a float

calcDist

public static float calcDist(java.awt.Point p1,
                             java.awt.Point p2)
Calculate the distance between two points (p1 and p2).

Parameters:
p1 - first point
p2 - second point
Returns:
the distance between p1 and p2

calcX

public static float calcX(java.awt.Point initP,
                          float dist,
                          float angle)
Calculate the X coordinate of a point situated at distance dist, angle angle from a given point initP.

Parameters:
initP - reference point
dist - distance from the reference point to the desired point
angle - angle from the reference point to the desired point
Returns:
the X coordinate of the point

calcY

public static float calcY(java.awt.Point initP,
                          float dist,
                          float angle)
Calculate the Y coordinate of a point situated at distance dist, angle angle from a given point initP.

Parameters:
initP - reference point
dist - distance from the reference point to the desired point
angle - angle from the reference point to the desired point
Returns:
the Y coordinate of the point

calcDistPoint

public static java.awt.Point calcDistPoint(java.awt.Point initP,
                                           float dist,
                                           float angle)
Calculate the coordinates of a point situated at distance dist, angle angle from a given point initP.

Parameters:
initP - reference point
dist - distance from the reference point to the desired point
angle - angle from the reference point to the desired point
Returns:
the coordinates of the new point as a Point (AWT)

calcAngle

public static float calcAngle(java.awt.Point p1,
                              java.awt.Point p2)
Calculate the angle between the line determined by the two points and the horizontal axis.

Parameters:
p1 - First point
p2 - Second point
Returns:
the angle as an integer