Package worldBuilder

Class 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 MeshPoints
      int[] neighbors
      indices of the MeshPoints surrounding this vicinity
      static int NUM_NEIGHBORS
      max number of MeshPoints that define a Vicinity (most are smaller)
    • Constructor Summary

      Constructors 
      Constructor Description
      Vicinity​(Mesh mesh, double x, double y)
      create a new (empty) vicinity
    • 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 MeshPoints
      double nearest​(double[] values)
      return the value of the nearest MeshPoint
      double nearestValid​(double[] values, double invalid)
      return the value of the nearest MeshPoint with a VALID value
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 searched
        x - coordinate of vicinity
        y - 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 values
        invalid - 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