Package worldBuilder
Class Vicinity
- java.lang.Object
-
- worldBuilder.Vicinity
-
- Direct Known Subclasses:
Nearest
,Polygon
,Proxcimity
public class Vicinity extends java.lang.Object
find and interpolate values from the surrounding MeshPoints to any map coordinate ... used to produce a (dense) Cartesian map from a (sparse) Voronoi Mesh.
-
-
Field Summary
Fields Modifier and Type Field Description double[]
distances
distances to each of the three closest MeshPointsint[]
neighbors
indices of the MeshPoints surrounding this vicinitystatic int
NUM_NEIGHBORS
max number of MeshPoints that define a Vicinity (most are smaller)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
interpolate(double[] values)
interpolate a value from those of my surrounding MeshPointsdouble
nearest(double[] values)
return the value of the nearest MeshPointdouble
nearestValid(double[] values, double invalid)
return the value of the nearest MeshPoint with a VALID value
-
-
-
Field Detail
-
NUM_NEIGHBORS
public static final int NUM_NEIGHBORS
max number of MeshPoints that define a Vicinity (most are smaller)- See Also:
- Constant Field Values
-
neighbors
public int[] neighbors
indices of the MeshPoints surrounding this vicinity
-
distances
public double[] distances
distances to each of the three closest MeshPoints
-
-
Constructor Detail
-
Vicinity
public Vicinity(Mesh mesh, double x, double y)
create a new (empty) vicinity- Parameters:
mesh
- to be searchedx
- coordinate of vicinityy
- coordinate of vicinity
-
-
Method Detail
-
interpolate
public double interpolate(double[] values)
interpolate a value from those of my surrounding MeshPoints- Parameters:
values
- array for all MeshPoints
-
nearest
public double nearest(double[] values)
return the value of the nearest MeshPoint- Parameters:
values
- array for all MeshPoints Note: I have stopped using Proxcimity Vicnities, and the first point in the first point in a Polygon Vicnity is the nearest, so we can just use the first value we find.
-
nearestValid
public double nearestValid(double[] values, double invalid)
return the value of the nearest MeshPoint with a VALID value- Parameters:
values
- array of per MeshPoint valuesinvalid
- the value to be ignored This function is used to find the water level associated with the nearest neighbor, where most nodes do not have a water level
-
-