Package org.empirewar.orbis.area
Class PolygonArea
java.lang.Object
org.empirewar.orbis.area.EncompassingArea
org.empirewar.orbis.area.PolygonArea
- Direct Known Subclasses:
PolyhedralArea
A 2D polygonal area.
-
Field Summary
FieldsFields inherited from class org.empirewar.orbis.area.EncompassingArea
boundaryPoints, max, min, points -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double x, double y, double z) Gets whether the specified point is within this area.booleancontains(org.joml.Vector3dc point) Set<org.joml.Vector3ic> Gets the maximum number of points for this area.intGets the minimum number of points for this area.AreaType<?> getType()Methods inherited from class org.empirewar.orbis.area.EncompassingArea
addPoint, addUpdateListener, calculateEncompassingArea, clearPoints, getBoundaryPoints, getMax, getMin, iterator, points, removePoint, removeUpdateListenerMethods 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
-
CODEC
-
-
Constructor Details
-
PolygonArea
public PolygonArea() -
PolygonArea
-
-
Method Details
-
contains
public boolean contains(org.joml.Vector3dc point) - See Also:
-
contains
public boolean contains(double x, double y, double z) Description copied from interface:AreaGets whether the specified point is within this area.This method will always return false if the area is incomplete.
- Parameters:
x- the x point to checky- the y point to checkz- the z point to check- Returns:
- true if the point is within the area specified by
Area.points()
-
getType
-
getMaximumPoints
Description copied from class:EncompassingAreaGets 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().- Specified by:
getMaximumPointsin classEncompassingArea- Returns:
- an
Optionalwith the number of maximum points, elseOptional.empty()if any number of points is applicable.
-
getMinimumPoints
public int getMinimumPoints()Description copied from class:EncompassingAreaGets the minimum number of points for this area.- Specified by:
getMinimumPointsin classEncompassingArea- Returns:
- the minimum number of points required to build this area
-
generateBoundaryPoints
- Specified by:
generateBoundaryPointsin classEncompassingArea
-