Interface Region

All Known Implementing Classes:
BoxRegion, SphereRegion

@AvailableSince("0.0.22") public interface Region
Represents a region between 2 positions
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static BoxRegion
    box(Position pos0, Position pos1)
    Create a box region between 2 positions
    boolean
    contains(Position position)
    Check if the position is in the region
    double
    distance(Position position)
    Return the distance between region and position If position is inside the region, return 0 (Note that this is not the same as the distance between the region and the center of the region) (Note this method is more expensive than contains(Position) method when you just want to check if the position is inside the region)
    sphere(Position center, double radius)
    Create a sphere region with center and radius
  • Method Details

    • box

      static BoxRegion box(Position pos0, Position pos1)
      Create a box region between 2 positions
      Parameters:
      pos0 - position 0
      pos1 - position 1
      Returns:
      a new box region instance
    • sphere

      static SphereRegion sphere(Position center, double radius)
      Create a sphere region with center and radius
      Parameters:
      center - center of the sphere
      radius - radius of the sphere
      Returns:
      a new sphere region instance
    • contains

      boolean contains(Position position)
      Check if the position is in the region
      Parameters:
      position - position to check
      Returns:
      true if the position is in the region or false otherwise
    • distance

      double distance(Position position)
      Return the distance between region and position If position is inside the region, return 0 (Note that this is not the same as the distance between the region and the center of the region) (Note this method is more expensive than contains(Position) method when you just want to check if the position is inside the region)
      Parameters:
      position - position
      Returns:
      distance between region and position (or 0 if position is inside the region)