Package worldBuilder
Class MeshPointHasher
- java.lang.Object
-
- worldBuilder.MeshPointHasher
-
public class MeshPointHasher extends java.lang.Object
class generates a single unique MapPoint for each unique coordinate pair, and find the already allocated point when coordinates are repeated. I have chosen to do this with an open hash table for time efficiency.
-
-
Field Summary
Fields Modifier and Type Field Description int
numVertices
number of (already) recorded MeshPointsMeshPoint[]
vertices
list of (already) recorded MeshPoints
-
Constructor Summary
Constructors Constructor Description MeshPointHasher(int max, double x_extent, double y_extent)
allocate a hash table and vertex list
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MeshPoint
findPoint(double x, double y)
find or create reference to MeshPoint at MapPoint(x,y)
-
-
-
Field Detail
-
numVertices
public int numVertices
number of (already) recorded MeshPoints
-
vertices
public MeshPoint[] vertices
list of (already) recorded MeshPoints
-
-
Method Detail
-
findPoint
public MeshPoint findPoint(double x, double y)
find or create reference to MeshPoint at MapPoint(x,y)- Parameters:
x
- desired location (in -0.5 to 0.5 map coordinates)y
- desired location (in -0.5 to 0.5 map coordinates)- Returns:
- new (or already associated) MeshPoint We use an open hash table to note index associated w/each hash value
-
-