Package org.empirewar.orbis.area
Class EncompassingArea
java.lang.Object
org.empirewar.orbis.area.EncompassingArea
- Direct Known Subclasses:
CuboidArea,PolygonArea,SphericalArea
public abstract sealed class EncompassingArea
extends Object
implements Area
permits CuboidArea, PolygonArea, SphericalArea
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddPoint(org.joml.Vector3ic point) Attempts to add a point to this area.voidaddUpdateListener(Runnable listener) protected voidCalculates the minimum and maximum points of this area.voidRemoves all points from this area.protected abstract Set<org.joml.Vector3ic> Set<org.joml.Vector3ic> Returns a set of points representing the boundary of this area.org.joml.Vector3icgetMax()Gets the maximum point of this area.Gets the maximum number of points for this area.org.joml.Vector3icgetMin()Gets the minimum point of this area.abstract intGets the minimum number of points for this area.@NotNull Iterator<org.joml.Vector3ic> iterator()Set<org.joml.Vector3ic> points()Gets the set of points that make up this area.booleanremovePoint(org.joml.Vector3ic point) Attempts to remove a point from this area.voidremoveUpdateListener(Runnable listener) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
points
-
boundaryPoints
-
min
protected final org.joml.Vector3i min -
max
protected final org.joml.Vector3i max
-
-
Method Details
-
addUpdateListener
-
removeUpdateListener
-
calculateEncompassingArea
protected void calculateEncompassingArea()Calculates the minimum and maximum points of this area. -
clearPoints
public void clearPoints()Description copied from interface:AreaRemoves all points from this area.- Specified by:
clearPointsin interfaceArea
-
addPoint
public boolean addPoint(org.joml.Vector3ic point) Description copied from interface:AreaAttempts to add a point to this area.This method will return false if the area does not support the addition of another point, e.g. a cuboid exceeding 4 points.
-
removePoint
public boolean removePoint(org.joml.Vector3ic point) Description copied from interface:AreaAttempts to remove a point from this area.This method will return as specified by
Set.remove(Object).- Specified by:
removePointin interfaceArea- Parameters:
point- the point to remove- Returns:
- specified by
Set.remove(Object)
-
getMin
public org.joml.Vector3ic getMin()Description copied from interface:AreaGets the minimum point of this area.This method does not guarantee returning a
Vector3ifromArea.points(); it is the minimum bounds point. -
getMax
public org.joml.Vector3ic getMax()Description copied from interface:AreaGets the maximum point of this area.This method does not guarantee returning a
Vector3ifromArea.points(); it is the maximum bounds point. -
points
Description copied from interface:AreaGets the set of points that make up this area.The returned set cannot be modified.
-
getBoundaryPoints
Description copied from interface:AreaReturns a set of points representing the boundary of this area.- Specified by:
getBoundaryPointsin interfaceArea
-
generateBoundaryPoints
-
getMaximumPoints
Gets the maximum number of points for this area.For some shapes such as polygons this is not applicable. In these cases, this method should instead return
Optional.empty().- Returns:
- an
Optionalwith the number of maximum points, elseOptional.empty()if any number of points is applicable.
-
getMinimumPoints
public abstract int getMinimumPoints()Gets the minimum number of points for this area.- Returns:
- the minimum number of points required to build this area
-
iterator
-