Hull2
Class JarvisMarch

java.lang.Object
  extended by Hull2.JarvisMarch

public class JarvisMarch
extends java.lang.Object

The Jarvis March class that realizes the Jarvis March algorithm to calculate the convex hull shape of a given area of points with X - Y co-ordinates. Takes to arrays, one for the X points and one for the Y points, calculates the convex hull and gives as output an array list with all the points that constracts the hull shape.


Nested Class Summary
static class JarvisMarch.Points
          The Points class that gets all the points who the system sends to the JarvisMarch Convex Hull realization.
 
Field Summary
static java.util.ArrayList arrayList
           
 JarvisMarch.Points hullPoints
           
static JarvisMarch.Points pts
           
 
Constructor Summary
JarvisMarch()
          Creates an empty instans of the JarvisMarch
JarvisMarch(JarvisMarch.Points pts)
          Creates a new instance of JarvisMarch, the algorithm that calculates the Convex Hull shape of the given points.
 
Method Summary
 int calculateHull()
          The calculateHull function, called from the JarvisMarch, starts the calculation of the convex hull shape.
 java.util.ArrayList forConvex(double[] x, double[] y)
          The forConvex function, who is called from the FindIt function when that has found an area who must be calculated from the Convex Hull and after if one or more Convex Hull shape intersects one or more other and recalculation is needed and gets the points who are going to be calcuteted, creates a new instance of the Point class, starts the JarvisMarch algorithm and after the calculation returns at the FindIt the convex Hull shape.
 JarvisMarch.Points getHullPoints()
          Retern Of Hull Points
 int getStartingPoint()
          Request and return Of The Starting Point
static double pseudoAngle(double dx, double dy)
          Angle`s Calculation Bettowen Two Points Part 2
static double quadrantOnePseudoAngle(double dx, double dy)
          Angle`s Calculation Bettowen Two Points Part 3
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pts

public static JarvisMarch.Points pts

arrayList

public static java.util.ArrayList arrayList

hullPoints

public JarvisMarch.Points hullPoints
Constructor Detail

JarvisMarch

public JarvisMarch()
Creates an empty instans of the JarvisMarch


JarvisMarch

public JarvisMarch(JarvisMarch.Points pts)
Creates a new instance of JarvisMarch, the algorithm that calculates the Convex Hull shape of the given points. Calls the calculateHull() function that is responsible for the calculation.

Parameters:
pts - Points
See Also:
calculateHull(), getHullPoints()
Method Detail

forConvex

public java.util.ArrayList forConvex(double[] x,
                                     double[] y)
The forConvex function, who is called from the FindIt function when that has found an area who must be calculated from the Convex Hull and after if one or more Convex Hull shape intersects one or more other and recalculation is needed and gets the points who are going to be calcuteted, creates a new instance of the Point class, starts the JarvisMarch algorithm and after the calculation returns at the FindIt the convex Hull shape.

Parameters:
x - double array with the x co-ordinates for all the points.
y - double array with the y co-ordinates for all the points.
Returns:
an arraylist with all the points that composes the convex hull shape.
See Also:
FindIt

calculateHull

public int calculateHull()
The calculateHull function, called from the JarvisMarch, starts the calculation of the convex hull shape.

Returns:
the number of hull points.
See Also:
getStartingPoint(), getStartingPoint(), addToHull(int), buildHullPoints()

getStartingPoint

public int getStartingPoint()
Request and return Of The Starting Point


pseudoAngle

public static double pseudoAngle(double dx,
                                 double dy)
Angle`s Calculation Bettowen Two Points Part 2


quadrantOnePseudoAngle

public static double quadrantOnePseudoAngle(double dx,
                                            double dy)
Angle`s Calculation Bettowen Two Points Part 3


getHullPoints

public JarvisMarch.Points getHullPoints()
Retern Of Hull Points