computational.geometry.pointlocation
Class ChainsMethod

java.lang.Object
  extended by computational.geometry.pointlocation.PointLocation
      extended by computational.geometry.pointlocation.ChainsMethod

public class ChainsMethod
extends PointLocation

Class implements Chains method for solving point location in planar triangulation with n points. Chains method has O(n log n) for preprocessing and O(log^2 n) query cost.


Field Summary
 
Fields inherited from class computational.geometry.pointlocation.PointLocation
history, points
 
Constructor Summary
ChainsMethod()
          Default constructor
ChainsMethod(java.util.Collection ps)
          Constructor with collection of points
ChainsMethod(java.util.Collection ps, LogManager history)
          Constructor with collection of points and history
 
Method Summary
 void checkPreconditions()
          Method used to verify if preconditions are satisfied
 void draw(java.awt.Graphics gfx)
          Draws triangulation to the graphics
 void draw(Point point, java.awt.Graphics gfx)
          Draws point to the graphics
 java.util.List getPoints()
          Returns list of points of triangulation.
 java.util.Collection getSegments()
          Returns collection of segments that compose the triangulation.
 Triangle getTriangle(Point point)
          Method executes query - localizes triangle that contains point.
 void update()
          Method executed every time when is needed to update the structure used in Chains method.
 
Methods inherited from class computational.geometry.pointlocation.PointLocation
addPoint, clear, deletePoint, getLogManager, getPolygon, isUpdated, movePoint, setLogManager, setPoints, setUpdated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainsMethod

public ChainsMethod()
Default constructor


ChainsMethod

public ChainsMethod(java.util.Collection ps)
Constructor with collection of points

Parameters:
ps - collection of input points

ChainsMethod

public ChainsMethod(java.util.Collection ps,
                    LogManager history)
Constructor with collection of points and history

Parameters:
ps - collection of input points
history - log used for tracking changes
Method Detail

checkPreconditions

public void checkPreconditions()
                        throws PreconditionViolatedException
Method used to verify if preconditions are satisfied

Specified by:
checkPreconditions in class PointLocation
Throws:
PreconditionViolatedException

draw

public void draw(java.awt.Graphics gfx)
Draws triangulation to the graphics

Overrides:
draw in class PointLocation
Parameters:
gfx -

draw

public void draw(Point point,
                 java.awt.Graphics gfx)
Draws point to the graphics

Overrides:
draw in class PointLocation
Parameters:
point -
gfx -

getPoints

public java.util.List getPoints()
Returns list of points of triangulation.

Overrides:
getPoints in class PointLocation
Returns:
list of points in triangulation

getSegments

public java.util.Collection getSegments()
Returns collection of segments that compose the triangulation.

Specified by:
getSegments in class PointLocation
Returns:
collection of segments in triangulation

getTriangle

public Triangle getTriangle(Point point)
Method executes query - localizes triangle that contains point.

Specified by:
getTriangle in class PointLocation
Parameters:
point - point for which query is executed

update

public void update()
Method executed every time when is needed to update the structure used in Chains method.

Specified by:
update in class PointLocation