javamorph
Class CTriangulation

java.lang.Object
  extended by javamorph.CTriangulation

public class CTriangulation
extends Object

Version:
1.1
Author:
claus.erhard.wimmer@googlemail.com
Program: JavaMorph V 1.1.
Class: CTriangulation.
License: GPLv2.
Description: Groups a set of points within one picture to a DELAUNAY triangulation.
Hint: Not more than 500 points expected.

Field Summary
private static double center_x
          Center x of the circumcircle of the triangle to test.
private static double center_y
          Center y of the circumcircle of the triangle to test.
private static double circle_radius
          Due to DELAUNAY.
private static int count
          Count of found new point relating to the line.
private static int height
          Height of the picture.
private static Vector<Point> order
          Collection of all input points, order not modified.
private static Point p1
          First point of the line to explore.
private static Point p2
          Second point of the line to explore.
private static Point pnew
          Point to test relating to the line: No other point shall lay nearer.
private static HashSet<Point> points
          Collection of all unique input points.
private static Queue<Point[]> queue
          Queue of explored points which have to be processed.
private static HashSet<CTriangle> triangles
          Result of the process is this triangulation.
private static HashSet<CLine> used
          Collection of lines which have already been processed.
private static int width
          Width of the picture.
 
Constructor Summary
CTriangulation()
           
 
Method Summary
private static void add(CTriangle temp)
          Add one left & one right triangle.
private static boolean circle()
          Calculates the circumcircle of the current test triangle's points.
private static void clear()
          Clear all permanent date of the collections.
private static void debug()
          Write left right and 50% triangulation into the debug directory.
private static boolean delaunayCond()
          Check the DELAUNAY condition of P1 P2 and PNEW.
private static double distance(Point p)
          Distance of one point to the center of the circumcircle.
private static Point findNearest(Point p1)
          Find the nearest neighbor of one mesh point.
private static void findPoint()
          Explore the third points for one line.
private static int indexOf(Point p)
          Seek one point within the ordered input list.
static void triangulate()
          Perform complete operation.
private static void work()
          Calculate the triangles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

private static int width
Width of the picture.


height

private static int height
Height of the picture.


order

private static final Vector<Point> order
Collection of all input points, order not modified.


points

private static final HashSet<Point> points
Collection of all unique input points. No point occurs twice. Order not original.


used

private static final HashSet<CLine> used
Collection of lines which have already been processed.


queue

private static final Queue<Point[]> queue
Queue of explored points which have to be processed.


triangles

private static final HashSet<CTriangle> triangles
Result of the process is this triangulation.


circle_radius

private static double circle_radius
Due to DELAUNAY. Circumcircle of the triangle to test.


center_x

private static double center_x
Center x of the circumcircle of the triangle to test.


center_y

private static double center_y
Center y of the circumcircle of the triangle to test.


p1

private static Point p1
First point of the line to explore.


p2

private static Point p2
Second point of the line to explore.


pnew

private static Point pnew
Point to test relating to the line: No other point shall lay nearer.


count

private static int count
Count of found new point relating to the line. Max. two points can be found.

Constructor Detail

CTriangulation

public CTriangulation()
Method Detail

triangulate

public static void triangulate()
Perform complete operation.


clear

private static void clear()
Clear all permanent date of the collections.


work

private static void work()
Calculate the triangles.


findPoint

private static void findPoint()
Explore the third points for one line.


add

private static void add(CTriangle temp)
Add one left & one right triangle. Points are fetched ordered from left & right mesh them self.

Parameters:
temp - Input triangle.

indexOf

private static int indexOf(Point p)
Seek one point within the ordered input list.

Parameters:
p - Point to seek.
Returns:
Index of the point in the ordered input list.

delaunayCond

private static boolean delaunayCond()
Check the DELAUNAY condition of P1 P2 and PNEW. No other point shall be within the circumcircle of the three points.

Returns:
true if DELAUNAY condition is satisfied.

findNearest

private static Point findNearest(Point p1)
Find the nearest neighbor of one mesh point.

Parameters:
p1 - First point.
Returns:
Nearest point to p1.

circle

private static boolean circle()
Calculates the circumcircle of the current test triangle's points.

Returns:
true if such a circle can be found.

distance

private static double distance(Point p)
Distance of one point to the center of the circumcircle.

Parameters:
p - Point to be explored.
Returns:
Distance.

debug

private static void debug()
Write left right and 50% triangulation into the debug directory.