All Superinterfaces:
Iterable<PathPosition>

public interface Path extends Iterable<PathPosition>
  • Method Details

    • length

      int length()
      The length of the Path compiled from the number of positions
      Returns:
      the length of the path
    • interpolate

      Path interpolate(double resolution)
      Interpolates the positions of this Path to a new Path with the given resolution.

      The resulting path will have additional positions inserted between consecutive positions in the original path such that no two consecutive positions are more than `resolution` blocks apart. The interpolated positions are computed using linear interpolation, which means that the resulting path will have a smooth curve that passes through each of the original positions.

      Parameters:
      resolution - The desired distance between consecutive positions in the resulting path, in blocks. A lower value will result in a higher resolution and a smoother curve, but will also increase the number of positions in the resulting path and possibly reduce performance.
      Returns:
      a newly created Path with interpolated positions.
    • simplify

      Path simplify(double epsilon)
      Simplifies the path by removing intermediate positions based on the given epsilon value. The start and end positions are always included in the simplified path.
      Parameters:
      epsilon - the epsilon value representing the fraction of positions to keep (should be in the range greater than 0.0 to 1.0, inclusive)
      Returns:
      a simplified path containing a subset of positions from the original path
      Throws:
      IllegalArgumentException - if epsilon is not in the range greater than 0.0 to 1.0, inclusive
    • join

      Path join(Path path)
      Joins this Path with the given Path.
      Parameters:
      path - which will be appended at the end.
      Returns:
      Path the new Path
    • trim

      Path trim(int length)
      Trims this Path to the given length.
      Parameters:
      length - the length to which the Path will be trimmed.
      Returns:
      Path the new Path
    • mutatePositions

      Path mutatePositions(ParameterizedSupplier<PathPosition> mutator)
      Mutates each of the positions in the path with the given consumer
      Parameters:
      mutator - the ParameterizedSupplier to mutate the positions with
      Returns:
      Path the new Path
    • getStart

      PathPosition getStart()
      Returns the start position of the path
      Returns:
      PathPosition The position of the start
    • getEnd

      PathPosition getEnd()
      Returns the target position of the path
      Returns:
      PathPosition The position of the target