Class BranchEvaluator

java.lang.Object
com.hypixel.hytale.procedurallib.logic.cell.evaluator.BranchEvaluator
All Implemented Interfaces:
PointEvaluator

public class BranchEvaluator extends Object implements PointEvaluator
For each cell (point A) visited we pick a single random cardinal direction for it to connect to (point B) and find the distance of point x,y to the line AB, recording the closest result.

The connection direction is influenced by information stored on the second order variables on the provided ResultBuffer2d - this information represents some parent region that the branch network resides inside: - buffer.ix2 - the parent region's cell x-index - buffer.iy2 - the parent region's cell y-index - buffer.x2 - the parent region's cell centre-point x-coord. - buffer.y2 - the parent region's cell centre-point y-coord.

It follows that this information needs to be assigned to the ResultBuffer2d prior to calling this evaluator. See usage in BranchNoise.

Branch connection positions are compared against the parent region's centre point to determine the overall direction of the branch network. This allows the branch networks to flow from centre-out, edge-in, or to hold a uniform direction across the entire parent region.

  • Constructor Details

  • Method Details

    • getJitter

      public CellJitter getJitter()
      Specified by:
      getJitter in interface PointEvaluator
      Returns:
      The jitter configuration to use when calculating cell centre-points.
    • evalPoint

      public void evalPoint(int seed, double x, double y, int hashA, int cax, int cay, double ax, double ay, @Nonnull ResultBuffer.ResultBuffer2d buffer)
      Description copied from interface: PointEvaluator
      Evaluate the distance to a cell-point in a 2D neighborhood, recording only the closest result.
      Specified by:
      evalPoint in interface PointEvaluator
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      hashA - The seeded hash of the cell.
      cax - The x-index of the cell.
      cay - The y-index of the cell.
      ax - The x-coordinate of the cell centre point.
      ay - The y-coordinate of the cell centre point.
      buffer - The buffer into which the result of the evaluation is recorded.
    • evalPoint2

      public void evalPoint2(int seed, double x, double y, int cellHash, int xi, int yi, double vecX, double vecY, ResultBuffer.ResultBuffer2d buffer)
      Description copied from interface: PointEvaluator
      Evaluate the distance to a cell-point in a 2D neighborhood, recording the closest and second-closest result.
      Specified by:
      evalPoint2 in interface PointEvaluator
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      cellHash - The seeded hash of the cell.
      xi - The x-index of the cell.
      yi - The y-index of the cell.
      vecX - The x-coordinate of the cell centre point.
      vecY - The y-coordinate of the cell centre point.
      buffer - The buffer into which the result of the evaluation is recorded.
    • evalPoint

      public void evalPoint(int seed, double x, double y, double z, int cellHash, int cellX, int cellY, int cellZ, double cellPointX, double cellPointY, double cellPointZ, ResultBuffer.ResultBuffer3d buffer)
      Description copied from interface: PointEvaluator
      Evaluate the distance to a cell-point in a 3D neighborhood, recording only the closest result.
      Specified by:
      evalPoint in interface PointEvaluator
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      z - The z-coordinate being sampled.
      cellHash - The seeded hash of the cell.
      cellX - The x-index of the cell.
      cellY - The y-index of the cell.
      cellZ - The z-index of the cell.
      cellPointX - The x-coordinate of the cell centre point.
      cellPointY - The y-coordinate of the cell centre point.
      cellPointZ - The z-coordinate of the cell centre point.
      buffer - The buffer into which the result of the evaluation is recorded.
    • evalPoint2

      public void evalPoint2(int seed, double x, double y, double z, int cellHash, int cellX, int cellY, int cellZ, double cellPointX, double cellPointY, double cellPointZ, ResultBuffer.ResultBuffer3d buffer)
      Description copied from interface: PointEvaluator
      Evaluate the distance to a cell-point in a 3D neighborhood, recording the closest and second-closest result.
      Specified by:
      evalPoint2 in interface PointEvaluator
      Parameters:
      seed - The seed being sampled.
      x - The x-coordinate being sampled.
      y - The y-coordinate being sampled.
      z - The z-coordinate being sampled.
      cellHash - The seeded hash of the cell.
      cellX - The x-index of the cell.
      cellY - The y-index of the cell.
      cellZ - The z-index of the cell.
      cellPointX - The x-coordinate of the cell centre point.
      cellPointY - The y-coordinate of the cell centre point.
      cellPointZ - The z-coordinate of the cell centre point.
      buffer - The buffer into which the result of the evaluation is recorded.