Class SphericalArea

java.lang.Object
org.empirewar.orbis.area.EncompassingArea
org.empirewar.orbis.area.SphericalArea
All Implemented Interfaces:
Iterable<org.joml.Vector3ic>, Area

public final class SphericalArea extends EncompassingArea
A spherical area with a single center point and a radius.
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<SphericalArea> 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: Area
      Gets 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 check
      y - the y point to check
      z - the z point to check
      Returns:
      true if the point is within the area specified by Area.points()
    • getType

      public AreaType<?> getType()
    • getMaximumPoints

      public Optional<Integer> getMaximumPoints()
      Description copied from class: EncompassingArea
      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().

      Specified by:
      getMaximumPoints in class EncompassingArea
      Returns:
      an Optional with the number of maximum points, else Optional.empty() if any number of points is applicable.
    • getMinimumPoints

      public int getMinimumPoints()
      Description copied from class: EncompassingArea
      Gets the minimum number of points for this area.
      Specified by:
      getMinimumPoints in class EncompassingArea
      Returns:
      the minimum number of points required to build this area
    • calculateEncompassingArea

      protected void calculateEncompassingArea()
      Description copied from class: EncompassingArea
      Calculates the minimum and maximum points of this area.
      Overrides:
      calculateEncompassingArea in class EncompassingArea
    • getCenter

      public org.joml.Vector3ic getCenter()
    • getRadius

      public double getRadius()
    • setRadius

      public void setRadius(double radius)
    • generateBoundaryPoints

      public Set<org.joml.Vector3ic> generateBoundaryPoints()
      Specified by:
      generateBoundaryPoints in class EncompassingArea