java.lang.Object
net.botwithus.rs3.game.Area
- All Implemented Interfaces:
Locatable
- Direct Known Subclasses:
Area.Circular
,Area.Polygonal
,Area.Rectangular
,Area.Singular
public abstract sealed class Area
extends Object
implements Locatable
permits Area.Singular, Area.Rectangular, Area.Circular, Area.Polygonal
An Area represents a group of Coordinates in the world graph.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
static final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
@NonNull Area
getArea()
Gets the area that the entity occupies on the world graph@Nullable Coordinate
This method calculates and returns the centroid of a set of coordinates.abstract @NonNull List<Coordinate>
getCoordinatesInArea
(Coordinate checkCoords) final Set<Coordinate>
getOverlap
(Area area) @NonNull Set<Coordinate>
getOverlap
(Area area, boolean ignorePlane) Gets a set of the overlapping coordinates between this area and the provided area.@Nullable Coordinate
boolean
final boolean
abstract Area.Circular
abstract Area.Polygonal
abstract Area.Rectangular
Gets this area as an Area.Singular which is comprised of a single CoordinateMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.botwithus.rs3.game.Locatable
distanceTo, getCoordinate, isReachable
-
Constructor Details
-
Area
public Area()
-
-
Method Details
-
getArea
Description copied from interface:Locatable
Gets the area that the entity occupies on the world graph -
getOverlap
-
getOverlap
Gets a set of the overlapping coordinates between this area and the provided area.- Parameters:
area
- The area to compare with for overlap. If it's null or it has no coordinates, an empty set is returned.ignorePlane
- If true, only X and Y coordinates are considered for overlap. If false, the Z (plane) coordinate is also considered.- Returns:
- A set of overlapping coordinates. If there are no overlapping coordinates, an empty set is returned.
-
overlaps
-
overlaps
-
toSingular
Gets this area as an Area.Singular which is comprised of a single Coordinate- Returns:
- This area as an Area.Singular if it has a single Coordinate, otherwise null.
-
getRandomCoordinate
-
getRandomWalkableCoordinate
-
getWalkableCoordinates
-
getCoordinatesInArea
-
toRectangular
-
toPolygonal
-
toCircular
-
contains
-
getCoordinates
-
getCentroid
This method calculates and returns the centroid of a set of coordinates. The centroid is the arithmetic mean position of all the points in the shape. The method first checks if the list of coordinates is empty. If it is, it returns null. If the list is not empty, it calculates the total sum of x, y, and z coordinates separately. After that, it calculates the average of x, y, and z by dividing the total sum by the number of coordinates. The method then returns a new Coordinate object with the average x, y, and z values.- Returns:
- The centroid of the set of coordinates as a Coordinate object. If the list of coordinates is empty, returns null.
-