Class ModelCalculations


  • public class ModelCalculations
    extends java.lang.Object
    Calculates the 2D coordinates of a 3D model on the screen.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.awt.Polygon getCanvasTileAreaFromPoly​(RSClient rsClient, java.awt.Polygon polygon)
      Returns a Polygon representing the canvas tile area from the given Polygon on the client.
      static java.awt.Shape getClickbox​(RSClient rsClient, RSModel model, int height, int orientation, Positionable point)
      Returns the clickbox shape for the given model at the specified point on the screen.
      static java.awt.Shape getConvexHullOnScreen​(RSClient rsClient, RSModel model, int orientation, Positionable localPoint, int height)
      Retrieves the convex hull of a given model on the screen.
      static RSWidget getMinimapDrawArea()
      Returns the appropriate RSWidget for the minimap draw area based on the current client settings.
      static java.awt.Polygon[] getPolygons​(RSClient rsClient, RSModel model, int orientation, Positionable localPoint)
      Returns an array of polygons representing the given RSModel with the specified orientation and local point.
      static java.awt.Polygon[] getPolygons​(RSClient rsClient, RSModel model, int orientation, Positionable localPoint, int height)
      Returns an array of Polygons representing a 3D model rendered in 2D space.
      static java.awt.Polygon[] getPolygonsOnScreen​(RSClient rsClient, RSModel model, int orientation, Positionable localPoint, int height)
      Retrieves an array of polygons representing the visible portion of a model on the game screen.
      static net.eternalclient.api.data.Point localToMinimap​(Positionable point)
      Translates a point from the local coordinate system to the minimap coordinate system.
      static net.eternalclient.api.data.Point localToMinimap​(Positionable point, int distance)
      Calculates the position of a point on the minimap relative to the player's location.
      static net.eternalclient.api.data.Point localToMinimap​(Positionable point, RSWidget widget)
      Converts a point from the local coordinate system to the minimap coordinate system.
      static net.eternalclient.api.data.Point localToMinimap​(Positionable point, RSWidget widget, int distance)
      Converts a local point to the minimap coordinates relative to a given widget, with a specified distance threshold.
      static void modelToCanvasOnScreen​(RSClient rsClient, int end, int x3dCenter, int y3dCenter, int z3dCenter, int rotate, int[] x3d, int[] y3d, int[] z3d, int[] x2d, int[] y2d, java.awt.Rectangle screen)
      Transforms the model coordinates to canvas coordinates on the screen using the CPU.
      • Methods inherited from class java.lang.Object

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

      • ModelCalculations

        public ModelCalculations()
    • Method Detail

      • getCanvasTileAreaFromPoly

        public static java.awt.Polygon getCanvasTileAreaFromPoly​(RSClient rsClient,
                                                                 java.awt.Polygon polygon)
        Returns a Polygon representing the canvas tile area from the given Polygon on the client.
        Parameters:
        rsClient - The RSClient object.
        polygon - The Polygon object representing the shape.
        Returns:
        A Polygon object representing the canvas tile area of the given shape.
      • getClickbox

        public static java.awt.Shape getClickbox​(RSClient rsClient,
                                                 RSModel model,
                                                 int height,
                                                 int orientation,
                                                 Positionable point)
        Returns the clickbox shape for the given model at the specified point on the screen.
        Parameters:
        rsClient - the RSClient instance
        model - the RSModel instance
        height - the height of the model
        orientation - the orientation of the model
        point - the LocalTile instance representing the coordinates of the point on the screen
        Returns:
        the clickbox shape for the model at the given point, or null if the model or bounds is null
      • getPolygons

        public static java.awt.Polygon[] getPolygons​(RSClient rsClient,
                                                     RSModel model,
                                                     int orientation,
                                                     Positionable localPoint)
        Returns an array of polygons representing the given RSModel with the specified orientation and local point.
        Parameters:
        rsClient - the RSClient instance
        model - the RSModel instance
        orientation - the orientation of the model
        localPoint - the local point of the model
        Returns:
        an array of polygons representing the RSModel
      • getPolygons

        public static java.awt.Polygon[] getPolygons​(RSClient rsClient,
                                                     RSModel model,
                                                     int orientation,
                                                     Positionable localPoint,
                                                     int height)
        Returns an array of Polygons representing a 3D model rendered in 2D space.
        Parameters:
        rsClient - the RSClient instance
        model - the RSModel to be rendered
        orientation - the orientation of the model
        localPoint - the LocalTile representing the position of the model
        height - the height adjustment for the model
        Returns:
        an array of Polygons representing the rendered model
      • getPolygonsOnScreen

        public static java.awt.Polygon[] getPolygonsOnScreen​(RSClient rsClient,
                                                             RSModel model,
                                                             int orientation,
                                                             Positionable localPoint,
                                                             int height)
        Retrieves an array of polygons representing the visible portion of a model on the game screen.
        Parameters:
        rsClient - the RSClient object
        model - the RSModel object representing the model
        orientation - the orientation of the model
        localPoint - the LocalTile representing the position of the model in the game world
        height - the height of the model
        Returns:
        an array of Polygon objects representing the visible portion of the model on the screen
      • getConvexHullOnScreen

        public static java.awt.Shape getConvexHullOnScreen​(RSClient rsClient,
                                                           RSModel model,
                                                           int orientation,
                                                           Positionable localPoint,
                                                           int height)
        Retrieves the convex hull of a given model on the screen.
        Parameters:
        rsClient - the RSClient object
        model - the RSModel to retrieve the convex hull for
        orientation - the orientation of the model
        localPoint - the LocalTile representing the position of the model
        height - the height of the model
        Returns:
        the convex hull of the model on the screen
      • modelToCanvasOnScreen

        public static void modelToCanvasOnScreen​(RSClient rsClient,
                                                 int end,
                                                 int x3dCenter,
                                                 int y3dCenter,
                                                 int z3dCenter,
                                                 int rotate,
                                                 int[] x3d,
                                                 int[] y3d,
                                                 int[] z3d,
                                                 int[] x2d,
                                                 int[] y2d,
                                                 java.awt.Rectangle screen)
        Transforms the model coordinates to canvas coordinates on the screen using the CPU.
        Parameters:
        rsClient - the RSClient instance
        end - the end variable
        x3dCenter - the x coordinate of the 3D center
        y3dCenter - the y coordinate of the 3D center
        z3dCenter - the z coordinate of the 3D center
        rotate - the rotation variable
        x3d - the array of x coordinates in 3D
        y3d - the array of y coordinates in 3D
        z3d - the array of z coordinates in 3D
        x2d - the array of x coordinates in 2D
        y2d - the array of y coordinates in 2D
        screen - the Rectangle representing the screen
      • localToMinimap

        public static net.eternalclient.api.data.Point localToMinimap​(Positionable point)
        Translates a point from the local coordinate system to the minimap coordinate system.
        Parameters:
        point - the point to be translated
        Returns:
        the translated point in the minimap coordinate system
      • localToMinimap

        public static net.eternalclient.api.data.Point localToMinimap​(Positionable point,
                                                                      int distance)
        Calculates the position of a point on the minimap relative to the player's location.
        Parameters:
        point - the point to convert
        distance - the maximum distance from the player's location for the converted point to be considered valid
        Returns:
        the position of the converted point on the minimap, or null if it is too far from the player
      • localToMinimap

        public static net.eternalclient.api.data.Point localToMinimap​(Positionable point,
                                                                      RSWidget widget)
        Converts a point from the local coordinate system to the minimap coordinate system.
        Parameters:
        point - the point to convert
        widget - the widget used for conversion
        Returns:
        the converted point in the minimap coordinate system
      • localToMinimap

        public static net.eternalclient.api.data.Point localToMinimap​(Positionable point,
                                                                      RSWidget widget,
                                                                      int distance)
        Converts a local point to the minimap coordinates relative to a given widget, with a specified distance threshold.
        Parameters:
        point - the local point to convert
        widget - the widget to which the minimap coordinates are relative
        distance - the maximum distance threshold for the conversion
        Returns:
        the minimap coordinates as a Point object, or null if the distance exceeds the threshold or if the widget is hidden
      • getMinimapDrawArea

        public static RSWidget getMinimapDrawArea()
        Returns the appropriate RSWidget for the minimap draw area based on the current client settings.
        Returns:
        RSWidget - the minimap draw area widget