java.lang.Objectcomputational.geometry.pointlocation.PointLocation
computational.geometry.pointlocation.ChainsMethod
public class ChainsMethod
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 |
---|
public ChainsMethod()
public ChainsMethod(java.util.Collection ps)
ps
- collection of input pointspublic ChainsMethod(java.util.Collection ps, LogManager history)
ps
- collection of input pointshistory
- log used for tracking changesMethod Detail |
---|
public void checkPreconditions() throws PreconditionViolatedException
checkPreconditions
in class PointLocation
PreconditionViolatedException
public void draw(java.awt.Graphics gfx)
draw
in class PointLocation
gfx
- public void draw(Point point, java.awt.Graphics gfx)
draw
in class PointLocation
point
- gfx
- public java.util.List getPoints()
getPoints
in class PointLocation
public java.util.Collection getSegments()
getSegments
in class PointLocation
public Triangle getTriangle(Point point)
getTriangle
in class PointLocation
point
- point for which query is executedpublic void update()
update
in class PointLocation