Package org.empirewar.orbis.area
Class SphericalArea
java.lang.Object
org.empirewar.orbis.area.EncompassingArea
org.empirewar.orbis.area.SphericalArea
A spherical area with a single center point and a radius.
-
Field Summary
FieldsFields inherited from class org.empirewar.orbis.area.EncompassingArea
boundaryPoints, max, min, points -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalculates the minimum and maximum points of this area.booleancontains(double x, double y, double z) Gets whether the specified point is within this area.booleancontains(org.joml.Vector3dc point) Set<org.joml.Vector3ic> org.joml.Vector3icGets the maximum number of points for this area.intGets the minimum number of points for this area.doubleAreaType<?> getType()voidsetRadius(double radius) Methods inherited from class org.empirewar.orbis.area.EncompassingArea
addPoint, addUpdateListener, 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
-
SphericalArea
public SphericalArea()
-
-
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
-
calculateEncompassingArea
protected void calculateEncompassingArea()Description copied from class:EncompassingAreaCalculates the minimum and maximum points of this area.- Overrides:
calculateEncompassingAreain classEncompassingArea
-
getCenter
public org.joml.Vector3ic getCenter() -
getRadius
public double getRadius() -
setRadius
public void setRadius(double radius) -
generateBoundaryPoints
- Specified by:
generateBoundaryPointsin classEncompassingArea
-