Class ConvexPolyhedralRegion

All Implemented Interfaces:
IBatchProcessor, Region, Cloneable, Iterable<BlockVector3>, Collection<BlockVector3>, Set<BlockVector3>

public class ConvexPolyhedralRegion extends AbstractRegion
  • Constructor Details

    • ConvexPolyhedralRegion

      public ConvexPolyhedralRegion(@Nullable World world)
      Constructs an empty mesh, containing no vertices or triangles.
      Parameters:
      world - the world
    • ConvexPolyhedralRegion

      public ConvexPolyhedralRegion(ConvexPolyhedralRegion region)
      Constructs an independent copy of the given region.
      Parameters:
      region - the region to copy
  • Method Details

    • clear

      public void clear()
      Clears the region, removing all vertices and triangles.
      Specified by:
      clear in interface Collection<BlockVector3>
      Specified by:
      clear in interface Set<BlockVector3>
      Overrides:
      clear in class AbstractCollection<BlockVector3>
    • addVertex

      public boolean addVertex(BlockVector3 vertex)
      Add a vertex to the region.
      Parameters:
      vertex - the vertex
      Returns:
      true, if something changed.
    • isDefined

      public boolean isDefined()
    • getMinimumPoint

      public BlockVector3 getMinimumPoint()
      Description copied from interface: Region
      Get the lower point of a region.
      Returns:
      min. point
    • getMaximumPoint

      public BlockVector3 getMaximumPoint()
      Description copied from interface: Region
      Get the upper point of a region.
      Returns:
      max. point
    • getCenter

      public Vector3 getCenter()
      Description copied from interface: Region
      Get the center point of a region. Note: Coordinates will not be integers if the corresponding lengths are even.
      Specified by:
      getCenter in interface Region
      Overrides:
      getCenter in class AbstractRegion
      Returns:
      center point
    • expand

      public void expand(BlockVector3... changes) throws RegionOperationException
      Description copied from interface: Region
      Expand the region.
      Parameters:
      changes - array/arguments with multiple related changes
      Throws:
      RegionOperationException - if the operation cannot be performed
    • contract

      public void contract(BlockVector3... changes) throws RegionOperationException
      Description copied from interface: Region
      Contract the region.
      Parameters:
      changes - array/arguments with multiple related changes
      Throws:
      RegionOperationException - if the operation cannot be performed
    • shift

      public void shift(BlockVector3 change) throws RegionOperationException
      Description copied from interface: Region
      Shift the region.
      Specified by:
      shift in interface Region
      Overrides:
      shift in class AbstractRegion
      Parameters:
      change - the change
      Throws:
      RegionOperationException - if the operation cannot be performed
    • contains

      public boolean contains(BlockVector3 position)
      Description copied from interface: Region
      Returns true based on whether the region contains the point.
      Parameters:
      position - the position
      Returns:
      true if contained
    • getVertices

      public Collection<BlockVector3> getVertices()
    • getTriangles

      public Collection<Triangle> getTriangles()
    • clone

      public AbstractRegion clone()
      Description copied from interface: Region
      Make a clone of the region.
      Specified by:
      clone in interface Region
      Overrides:
      clone in class AbstractRegion
      Returns:
      a cloned version
    • containsEntireCuboid

      public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz)