Class Coord

java.lang.Object
net.storm.sdk.coords.Coord

public class Coord extends Object
Utility class for coordinate calculations and distance measurements.

This class provides methods for calculating straight-line (Euclidean) distances between world points, which is useful for pathfinding and proximity checks.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    distanceTo2DHypotenuse(net.runelite.api.coords.WorldPoint origin, net.runelite.api.coords.WorldPoint target)
    Calculates the straight-line distance between two points, ignoring plane.
    static float
    distanceToHypotenuse(net.runelite.api.coords.WorldPoint origin, net.runelite.api.coords.WorldPoint target)
    Gets the straight-line distance between the origin point and the target point.

    Methods inherited from class java.lang.Object

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

    • Coord

      public Coord()
  • Method Details

    • distanceToHypotenuse

      public static float distanceToHypotenuse(net.runelite.api.coords.WorldPoint origin, net.runelite.api.coords.WorldPoint target)
      Gets the straight-line distance between the origin point and the target point.

      This method considers the plane (height level) of both points. If the target is not on the same plane as the origin, this method will return Float.MAX_VALUE.

      If ignoring the plane is desired, use the distanceTo2DHypotenuse(WorldPoint, WorldPoint) method instead.

      Parameters:
      origin - the starting world point
      target - the destination world point
      Returns:
      the straight-line distance, or Float.MAX_VALUE if on different planes
    • distanceTo2DHypotenuse

      public static float distanceTo2DHypotenuse(net.runelite.api.coords.WorldPoint origin, net.runelite.api.coords.WorldPoint target)
      Calculates the straight-line distance between two points, ignoring plane.

      This method disregards the plane (height level) value of the two tiles and returns the simple Euclidean distance between the X-Y coordinate pairs.

      This is useful when you want to calculate distance regardless of which floor/level the points are on.

      Parameters:
      origin - the starting world point
      target - the destination world point
      Returns:
      the straight-line distance (ignoring plane)