Class PolygonArea

java.lang.Object
org.empirewar.orbis.area.EncompassingArea
org.empirewar.orbis.area.PolygonArea
All Implemented Interfaces:
Iterable<org.joml.Vector3ic>, Area
Direct Known Subclasses:
PolyhedralArea

public sealed class PolygonArea extends EncompassingArea permits PolyhedralArea
A 2D polygonal area.
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<PolygonArea> CODEC
  • Constructor Details

    • PolygonArea

      public PolygonArea()
    • PolygonArea

      protected PolygonArea(List<org.joml.Vector3ic> points)
  • 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
    • generateBoundaryPoints

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