Class ModelCalculations
- java.lang.Object
-
- net.eternalclient.api.utilities.math.ModelCalculations
-
public class ModelCalculations extends java.lang.Object
Calculates the 2D coordinates of a 3D model on the screen.
-
-
Constructor Summary
Constructors Constructor Description ModelCalculations()
-
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.
-
-
-
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 instancemodel
- the RSModel instanceheight
- the height of the modelorientation
- the orientation of the modelpoint
- 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 instancemodel
- the RSModel instanceorientation
- the orientation of the modellocalPoint
- 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 instancemodel
- the RSModel to be renderedorientation
- the orientation of the modellocalPoint
- the LocalTile representing the position of the modelheight
- 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 objectmodel
- the RSModel object representing the modelorientation
- the orientation of the modellocalPoint
- the LocalTile representing the position of the model in the game worldheight
- 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 objectmodel
- the RSModel to retrieve the convex hull fororientation
- the orientation of the modellocalPoint
- the LocalTile representing the position of the modelheight
- 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 instanceend
- the end variablex3dCenter
- the x coordinate of the 3D centery3dCenter
- the y coordinate of the 3D centerz3dCenter
- the z coordinate of the 3D centerrotate
- the rotation variablex3d
- the array of x coordinates in 3Dy3d
- the array of y coordinates in 3Dz3d
- the array of z coordinates in 3Dx2d
- the array of x coordinates in 2Dy2d
- the array of y coordinates in 2Dscreen
- 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 convertdistance
- 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 convertwidget
- 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 convertwidget
- the widget to which the minimap coordinates are relativedistance
- 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
-
-