Package org.anchoranalysis.spatial.box
Class PointRange
Object
PointRange
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int x, int y, int z) Adds a new point to be considered in the range.void
add
(ReadableTuple3i point) Adds a new point to be considered in the range.boolean
isEmpty()
Has a valid min and max defined?Creates aBoundingBox
to just cover the range of points that have been added.LiketoBoundingBox()
but if no points exist, an exception is not thrown.
-
Constructor Details
-
PointRange
public PointRange()
-
-
Method Details
-
add
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
Creates aBoundingBox
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
LiketoBoundingBox()
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.
-