Class Distance

java.lang.Object
net.botwithus.rs3.game.Distance

public class Distance extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    between(double x1, double y1, double x2, double y2)
    Gets the euclidean distance between the two sets of (x,y) points.
    static double
    between(@NotNull Point first, @NotNull Point second)
     
    static double
    between(@NotNull Locatable first, @NotNull Locatable second)
    Gets the distance between two Locatable entities that exist on the world graph.
    static double
    to(@NotNull Locatable other)
    Gets the euclidean distance between the local player and assuming they're on the same plane/z-level.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Distance

      public Distance()
  • Method Details

    • between

      public static double between(@NotNull @NotNull Locatable first, @NotNull @NotNull Locatable second)
      Gets the distance between two Locatable entities that exist on the world graph. If either Locatable is not on the world graph or they're on different Z levels, the method returns Double.NaN.
      Parameters:
      first - a non-null Locatable on the world graph.
      second - a different non-null Locatable on the world graph.
      Returns:
      The distance between the two Locatables, or Double.NaN if either Locatable is not on the world graph or they're on different Z levels.
    • between

      public static double between(@NotNull @NotNull Point first, @NotNull @NotNull Point second)
    • between

      public static double between(double x1, double y1, double x2, double y2)
      Gets the euclidean distance between the two sets of (x,y) points.
      Parameters:
      x1 - The x-coordinate of the first point.
      y1 - The y-coordinate of the first point.
      x2 - The x-coordinate of the second point.
      y2 - The y-coordinate of the second point.
      Returns:
      The Euclidean distance between the two points.
    • to

      public static double to(@NotNull @NotNull Locatable other)
      Gets the euclidean distance between the local player and assuming they're on the same plane/z-level.
      Parameters:
      other - A locatable that exists on the world graph.
      Returns:
      The euclidean distance between the local player and in 2d space, or Double.NaN if it can't be determined.