Class BorderDistanceFunction

java.lang.Object
com.hypixel.hytale.procedurallib.logic.cell.BorderDistanceFunction
All Implemented Interfaces:
CellDistanceFunction

public class BorderDistanceFunction extends Object implements CellDistanceFunction
  • Constructor Details

  • Method Details

    • scale

      public double scale(double value)
      Description copied from interface: CellDistanceFunction
      Convert the provided coordinate component to the scale of this CellDistanceFunction.
      Specified by:
      scale in interface CellDistanceFunction
      Parameters:
      value - The coordinate component to scale.
      Returns:
      The coordinate component scaled to this CellDistanceFunction's domain.
    • invScale

      public double invScale(double value)
      Description copied from interface: CellDistanceFunction
      Convert the provided coordinate component to the inverse scale of this CellDistanceFunction.
      Specified by:
      invScale in interface CellDistanceFunction
      Parameters:
      value - The coordinate component to scale.
      Returns:
      The coordinate component inversely scaled from this CellDistanceFunction's domain.
    • getCellX

      public int getCellX(double x, double y)
      Description copied from interface: CellDistanceFunction
      Get the x-index of the cell that point x,y is inside.
      Specified by:
      getCellX in interface CellDistanceFunction
      Parameters:
      x - The x-coordinate of the point.
      y - The y-coordinate of the point.
      Returns:
      The cell's x-index.
    • getCellY

      public int getCellY(double x, double y)
      Description copied from interface: CellDistanceFunction
      Get the y-index of the cell that point x,y is inside.
      Specified by:
      getCellY in interface CellDistanceFunction
      Parameters:
      x - The x-coordinate of the point.
      y - The y-coordinate of the point.
      Returns:
      The cell's y-index.
    • nearest2D

      public void nearest2D(int seed, double x, double y, int cellX, int cellY, @Nonnull ResultBuffer.ResultBuffer2d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Calculate the distance to the nearest cell centre-point of a 2D cell neighborhood.
      Specified by:
      nearest2D in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      cellX - The x-index of cell to evaluate around.
      cellY - The y-index of cell to evaluate around.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • transition2D

      public void transition2D(int seed, double x, double y, int cellX, int cellY, @Nonnull ResultBuffer.ResultBuffer2d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Calculate the distance to the nearest and second-nearest cell centre-points of a 2D cell neighborhood.
      Specified by:
      transition2D in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      cellX - The x-index of cell to evaluate around.
      cellY - The y-index of cell to evaluate around.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • nearest3D

      public void nearest3D(int seed, double x, double y, double z, int cellX, int cellY, int cellZ, ResultBuffer.ResultBuffer3d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Calculate the distance to the nearest cell centre-point of a 3D cell neighborhood.
      Specified by:
      nearest3D in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      z - The y-coordinate being sampled.
      cellX - The x-index of cell to evaluate around.
      cellY - The y-index of cell to evaluate around.
      cellZ - The z-index of cell to evaluate around.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • transition3D

      public void transition3D(int seed, double x, double y, double z, int cellX, int cellY, int cellZ, ResultBuffer.ResultBuffer3d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Calculate the distance to the nearest and second-nearest cell centre-points of a 2D cell neighborhood.
      Specified by:
      transition3D in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      z - The y-coordinate being sampled.
      cellX - The x-index of cell to evaluate around.
      cellY - The y-index of cell to evaluate around.
      cellZ - The z-index of cell to evaluate around.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • evalPoint

      public void evalPoint(int seed, double x, double y, int cellX, int cellY, ResultBuffer.ResultBuffer2d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Evaluate distance to the given cell centre-point recording only the closest result.
      Specified by:
      evalPoint in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      cellX - The x-index of cell being evaluated.
      cellY - The y-index of cell being evaluated.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • evalPoint2

      public void evalPoint2(int seed, double x, double y, int cellX, int cellY, ResultBuffer.ResultBuffer2d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Evaluate distance to the given cell centre-point recording the closest and second-closest result.
      Specified by:
      evalPoint2 in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      cellX - The x-index of cell being evaluated.
      cellY - The y-index of cell being evaluated.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • evalPoint

      public void evalPoint(int seed, double x, double y, double z, int cellX, int cellY, int cellZ, ResultBuffer.ResultBuffer3d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Evaluate distance to the given cell centre-point recording only the closest result.
      Specified by:
      evalPoint in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      z - The y-coordinate being sampled.
      cellX - The x-index of cell being evaluated.
      cellY - The y-index of cell being evaluated.
      cellZ - The z-index of cell being evaluated.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • evalPoint2

      public void evalPoint2(int seed, double x, double y, double z, int cellX, int cellY, int cellZ, ResultBuffer.ResultBuffer3d buffer, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Evaluate distance to the given cell centre-point recording the closest and second-closest result.
      Specified by:
      evalPoint2 in interface CellDistanceFunction
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      z - The y-coordinate being sampled.
      cellX - The x-index of cell being evaluated.
      cellY - The y-index of cell being evaluated.
      cellZ - The z-index of cell being evaluated.
      buffer - The buffer into which the result of the evaluation is recorded.
      pointEvaluator - A function that evaluates each cell centre-point.
    • collect

      public <T> void collect(int originalSeed, int seed, int minX, int minY, int maxX, int maxY, ResultBuffer.Bounds2d bounds, T ctx, PointConsumer<T> collector, PointEvaluator pointEvaluator)
      Description copied from interface: CellDistanceFunction
      Iterate the cell-grid between the two provided corner coordinates and collect the cell centre-points of each cell visited.
      Specified by:
      collect in interface CellDistanceFunction
      Type Parameters:
      T - The type of the contextual information being passed to the collector.
      Parameters:
      originalSeed - A seed from which child-seeds may be offset.
      seed - The seed used to determine cell centre-points.
      minX - The x-index of the inclusive lower corner of the cell region.
      minY - The y-index of the inclusive lower corner of the cell region.
      maxX - The x-index of the inclusive upper corner of the cell region.
      maxY - The y-index of the inclusive upper corner of the cell region.
      bounds - The bounds that generated points must be limited to.
      ctx - An arbitrary piece of contextual information to pass to the collector for each point visited.
      collector - A consumer for each visited cell centre-point.
      pointEvaluator - A function that evaluates each cell centre-point.
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object