|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jzy3d.plot3d.builder.delaunay.jdt.Delaunay_Triangulation
public class Delaunay_Triangulation
This class represents a Delaunay Triangulation. The class was written for a
large scale triangulation (1000 - 200,000 vertices). The application main use
is 3D surface (terrain) presentation.
The class main properties are the following:
- fast point location. (O(n^0.5)), practical runtime is often very fast.
- handles degenerate cases and none general position input (ignores duplicate
points).
- save & load from\to text file in TSIN format.
- 3D support: including z value approximation.
- standard java (1.5 generic) iterators for the vertices and triangles.
- smart iterator to only the updated triangles - for terrain simplification
Testing (done in early 2005): Platform java 1.5.02 windows XP (SP2), AMD
laptop 1.6G sempron CPU 512MB RAM. Constructing a triangulation of 100,000
vertices takes ~ 10 seconds. point location of 100,000 points on a
triangulation of 100,000 vertices takes ~ 5 seconds.
Note: constructing a triangulation with 200,000 vertices and more requires
extending java heap size (otherwise an exception will be thrown).
Bugs: if U find a bug or U have an idea as for how to improve the code,
please send me an email to: benmo@ariel.ac.il
Field Summary | |
---|---|
Triangle_dt |
startTriangleHull
|
Constructor Summary | |
---|---|
Delaunay_Triangulation()
creates an empty Delaunay Triangulation. |
|
Delaunay_Triangulation(Point_dt[] ps)
creates a Delaunay Triangulation from all the points. |
|
Delaunay_Triangulation(java.lang.String file)
creates a Delaunay Triangulation from all the points in the suggested tsin file or from a smf file (off like). if the file name is .smf - read it as an smf file as try to read it as .tsin Note: duplicated points are ignored! |
Method Summary | |
---|---|
Point_dt[] |
calcVoronoiCell(Triangle_dt triangle,
Point_dt p)
Calculates a Voronoi cell for a given neighborhood in this triangulation. |
int |
CH_size()
compute the number of vertices in the convex hull. |
java.util.Iterator<Point_dt> |
CH_vertices_Iterator()
returns an iterator to the set of all the points on the XY-convex hull |
boolean |
contains(double x,
double y)
|
boolean |
contains(Point_dt p)
|
void |
deletePoint(Point_dt pointToDelete)
Deletes the given point from this. |
Triangle_dt |
find(Point_dt p)
finds the triangle the query point falls in, note if out-side of this triangulation a half plane triangle will be returned (see contains), the search has expected time of O(n^0.5), and it starts form a fixed triangle (this.startTriangle), |
Triangle_dt |
find(Point_dt p,
Triangle_dt start)
finds the triangle the query point falls in, note if out-side of this triangulation a half plane triangle will be returned (see contains). the search starts from the the start triangle |
Point_dt |
findClosePoint(Point_dt pointToDelete)
return a point from the trangulation that is close to pointToDelete |
java.util.Vector<Triangle_dt> |
findTriangleNeighborhood(Triangle_dt firstTriangle,
Point_dt point)
|
BoundingBox |
getBoundingBox()
|
java.util.Iterator<Triangle_dt> |
getLastUpdatedTriangles()
returns an iterator object involved in the last update. |
int |
getModeCounter()
returns the changes counter for this triangulation |
void |
IndexData(int xCellCount,
int yCellCount)
Index the triangulation using a grid index |
void |
insertPoint(Point_dt p)
insert the point to this Delaunay Triangulation. |
Point_dt |
maxBoundingBox()
return the max point of the bounding box of this triangulation {{x1,y1,z1}} |
Point_dt |
minBoundingBox()
return the min point of the bounding box of this triangulation {{x0,y0,z0}} |
void |
RemoveIndex()
Remove any existing spatial indexing |
int |
size()
the number of (different) vertices in this triangulation. |
java.util.Iterator<Triangle_dt> |
trianglesIterator()
computes the current set (vector) of all triangles and return an iterator to them. |
int |
trianglesSize()
|
java.util.Iterator<Point_dt> |
verticesIterator()
returns an iterator to the set of points compusing this triangulation. |
void |
write_CH(java.lang.String tsinFile)
|
void |
write_smf(java.lang.String smfFile)
this method write the triangulation as an SMF file (OFF like format) |
void |
write_tsin(java.lang.String tsinFile)
write all the vertices of this triangulation to a text file of the following format #vertices (n) x1 y1 z1 ... |
double |
z(double x,
double y)
|
Point_dt |
z(Point_dt q)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Triangle_dt startTriangleHull
Constructor Detail |
---|
public Delaunay_Triangulation()
public Delaunay_Triangulation(Point_dt[] ps)
public Delaunay_Triangulation(java.lang.String file) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public int size()
public int trianglesSize()
trianglesSize
in interface Triangulation
public int getModeCounter()
public void insertPoint(Point_dt p)
insertPoint
in interface Triangulation
p
- new vertex to be inserted the triangulation.public void deletePoint(Point_dt pointToDelete)
pointToDelete
- The given point to delete.
Implementation of the Mostafavia, Gold & Dakowicz algorithm
(2002).
By Eyal Roth & Doron Ganel (2009).public Point_dt findClosePoint(Point_dt pointToDelete)
pointToDelete
- the point that the user wants to delete
public Point_dt[] calcVoronoiCell(Triangle_dt triangle, Point_dt p)
triangle
- a triangle in the neighborhoodp
- corner point whose surrounding neighbors will be checked
public java.util.Iterator<Triangle_dt> getLastUpdatedTriangles()
public void write_tsin(java.lang.String tsinFile) throws java.lang.Exception
java.lang.Exception
public void write_smf(java.lang.String smfFile) throws java.lang.Exception
smfFile
- - file name
java.lang.Exception
public int CH_size()
public void write_CH(java.lang.String tsinFile) throws java.lang.Exception
java.lang.Exception
public Triangle_dt find(Point_dt p)
p
- query point
public Triangle_dt find(Point_dt p, Triangle_dt start)
p
- query pointstart
- the triangle the search starts at.
public java.util.Vector<Triangle_dt> findTriangleNeighborhood(Triangle_dt firstTriangle, Point_dt point)
public boolean contains(Point_dt p)
p
- query point
public boolean contains(double x, double y)
x
- - X cordination of the query pointy
- - Y cordination of the query point
public Point_dt z(Point_dt q)
q
- Query point
public double z(double x, double y)
x
- - X cordination of the query pointy
- - Y cordination of the query point
public BoundingBox getBoundingBox()
public Point_dt minBoundingBox()
public Point_dt maxBoundingBox()
public java.util.Iterator<Triangle_dt> trianglesIterator()
trianglesIterator
in interface Triangulation
public java.util.Iterator<Point_dt> CH_vertices_Iterator()
public java.util.Iterator<Point_dt> verticesIterator()
verticesIterator
in interface Triangulation
public void IndexData(int xCellCount, int yCellCount)
xCellCount
- number of grid cells in a rowyCellCount
- number of grid cells in a columnpublic void RemoveIndex()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |