Class PointRange

Object
PointRange

public final class PointRange extends Object
Tracks the range experienced by points in the X, Y and Z dimensions.

The minimum and maximum values of any point across the dimensions is always remembered.

Points can be dynamically added and the min/max is updated, as needed.

Author:
Owen Feehan
  • Constructor Details

    • PointRange

      public PointRange()
  • Method Details

    • add

      public void add(ReadableTuple3i point)
      Adds a new point to be considered in the range.
      Parameters:
      point - the point to add.
    • add

      public void add(int x, int y, int z)
      Adds a new point to be considered in the range.
      Parameters:
      x - the value along the X-axis for the point to add.
      y - the value along the Y-axis for the point to add.
      z - the value along the Z-axis for the point to add.
    • toBoundingBox

      public BoundingBox toBoundingBox() throws OperationFailedException
      Creates a BoundingBox to just cover the range of points that have been added.
      Returns:
      a newly created box that spans from the minimum to maximum values encountered in each dimension - across all added points.
      Throws:
      OperationFailedException - if no point has been added yet.
    • toBoundingBoxNoCheck

      public BoundingBox toBoundingBoxNoCheck()
      Like toBoundingBox() but if no points exist, an exception is not thrown.

      Consider calling isEmpty() first to check.

      Returns:
      a newly created box that spans from the minimum to maximum values encountered in each dimension - across all added points.
    • isEmpty

      public boolean isEmpty()
      Has a valid min and max defined?

      In other words, has at least one point been added?

      Returns:
      true iff a valid minimum and maximum exists.