voronoi
Class VoronoiGraph

java.lang.Object
  extended by voronoi.VoronoiGraph

public class VoronoiGraph
extends java.lang.Object

Class that contains the functionality for computing local generalized Voronoi graphs (lGVGs) using Java's native interface to employ the VRONI voronoi computation library.


Field Summary
private  double seg_x1
           
private  double seg_x2
           
private  double seg_y1
           
private  double seg_y2
           
 
Constructor Summary
VoronoiGraph()
          Constructs and initializes new instance.
 
Method Summary
private  void clearInputData()
          Allow new input data.
 void computeVD()
          Computes voronoi diagram, results are stored internally and can be read with getVEdge
 void finalize()
          Frees memory used by the Vroni library.
private  void finalizeProgram()
          Frees memory used for VD computation.
private  int getNumOfVEdges()
          Returns number of VEdges in voronoi diagram.
private  java.awt.geom.Line2D getSegment(int index)
          Returns a Line representing voronoi edge with index "index", null if this is not available.
private  int getVEdge(int index)
          Returns voronoi edge with index "index", coordinates of start and end point are stored in the seg_... variables and 0 is returned if edge was not available.
 java.util.Vector<java.awt.geom.Line2D> getVoronoiLineSegments()
          Returns a vector containing all voronoi edges as Line objects.
private  void handleSeg(double x1, double y1, double x2, double y2)
          Adds line segment (x1,y1)->(x2,y2) to set of obstacles regarded for VD computation.
private  void init()
          Initializes voronoi computation.
 void setInputLineSegments(java.util.Vector<java.awt.geom.Line2D> segments)
          Adds a vector of line segments to the set of obstacles regarded for Voronoi computation.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seg_x1

private double seg_x1

seg_y1

private double seg_y1

seg_x2

private double seg_x2

seg_y2

private double seg_y2
Constructor Detail

VoronoiGraph

public VoronoiGraph()
Constructs and initializes new instance.

Method Detail

handleSeg

private void handleSeg(double x1,
                       double y1,
                       double x2,
                       double y2)
Adds line segment (x1,y1)->(x2,y2) to set of obstacles regarded for VD computation.

Parameters:
x1 - x coordinate of start point
y1 - y coordinate of start point
x2 - x coordinate of end point
y2 - y coordinate of end point

computeVD

public void computeVD()
Computes voronoi diagram, results are stored internally and can be read with getVEdge


finalizeProgram

private void finalizeProgram()
Frees memory used for VD computation.


getVEdge

private int getVEdge(int index)
Returns voronoi edge with index "index", coordinates of start and end point are stored in the seg_... variables and 0 is returned if edge was not available.

Parameters:
index - index of voronoi edge to be returned
Returns:
0 if edge was not available

getNumOfVEdges

private int getNumOfVEdges()
Returns number of VEdges in voronoi diagram.


init

private void init()
Initializes voronoi computation.


clearInputData

private void clearInputData()
Allow new input data.


getSegment

private java.awt.geom.Line2D getSegment(int index)
Returns a Line representing voronoi edge with index "index", null if this is not available.

Parameters:
index - index of voronoi edge
Returns:
Line representing the voronoi edge

setInputLineSegments

public void setInputLineSegments(java.util.Vector<java.awt.geom.Line2D> segments)
Adds a vector of line segments to the set of obstacles regarded for Voronoi computation.

Parameters:
segments - vector of Line instances

getVoronoiLineSegments

public java.util.Vector<java.awt.geom.Line2D> getVoronoiLineSegments()
Returns a vector containing all voronoi edges as Line objects.

Returns:
vector of Line objects

finalize

public void finalize()
Frees memory used by the Vroni library.

Overrides:
finalize in class java.lang.Object