public class PredicateAtCorner extends Object implements VoxelsPredicate
VoxelsPredicate
to a corner in a larger global space
Coordinates are translated appropriately for any calls from the larger global space to the
space on which delegate
is defined.
Constructor and Description |
---|
PredicateAtCorner(ReadableTuple3i corner,
VoxelsPredicate delegate) |
Modifier and Type | Method and Description |
---|---|
boolean |
anyExists()
Does at least one value satisfy the predicate - across all voxels?
|
int |
count()
Counts the number of values satisfying the predicate - across all voxels.
|
int |
countForObject(ObjectMask object)
Counts the number of values satisfying the predicate - but restricted to voxels corresponding
to on in an object-mask.
|
ObjectMask |
deriveObject(BoundingBox box)
Creates an
ObjectMask for all the voxels inside the bounding-box satisfying the
predicate. |
Optional<ObjectMask> |
deriveObjectTight()
Creates an
ObjectMask for all the voxels satisfying the predicate, minimally fitting
the bounding-box to the on voxels only. |
boolean |
higherCountExistsThan(int threshold)
Whether the count is greater than a particular threshold.
|
boolean |
lowerCountExistsThan(int threshold)
Whether the count is less than a particular threshold.
|
public PredicateAtCorner(ReadableTuple3i corner, VoxelsPredicate delegate)
public boolean anyExists()
VoxelsPredicate
The computational cost of the operation is O(n)
in the number of voxels in the
worst-case. Typically, it exits earlier.
anyExists
in interface VoxelsPredicate
public int count()
VoxelsPredicate
The computational cost of the operation is O(n)
in the number of voxels.
count
in interface VoxelsPredicate
public boolean higherCountExistsThan(int threshold)
VoxelsPredicate
The computational cost of the operation is O(n)
in the number of voxels in the
worst-case. Typically, it exits earlier.
higherCountExistsThan
in interface VoxelsPredicate
threshold
- the threshold.public boolean lowerCountExistsThan(int threshold)
VoxelsPredicate
The computational cost of the operation is O(n)
in the number of voxels in the
worst-case. Typically, it exits earlier.
lowerCountExistsThan
in interface VoxelsPredicate
threshold
- the threshold.public int countForObject(ObjectMask object)
VoxelsPredicate
The computational cost of the operation is O(n)
in the number of voxels.
countForObject
in interface VoxelsPredicate
object
- the object-mask.public ObjectMask deriveObject(BoundingBox box)
VoxelsPredicate
ObjectMask
for all the voxels inside the bounding-box satisfying the
predicate.
Any voxels satisfying the predicate are set to on.
All other voxels are set to off.
Unlike VoxelsPredicate.deriveObjectTight()
, this operates only within a certain bounding-box, and
always uses an identical bounding-box for the created ObjectMask
as box
.
The computational cost of the operation is O(n)
in the number of voxels in box
only.
deriveObject
in interface VoxelsPredicate
box
- bounding-box.box
.public Optional<ObjectMask> deriveObjectTight()
VoxelsPredicate
ObjectMask
for all the voxels satisfying the predicate, minimally fitting
the bounding-box to the on voxels only.
Any voxels satisfying the predicate are set to on.
All other voxels are set to off.
Unlike VoxelsPredicate.deriveObject(BoundingBox)
, this operates all the voxels, and will
typically use a much smaller bounding-box (fewer voxels) to describe the on voxels.
The computational cost of the operation is O(n)
in the number of voxels in box
only.
deriveObjectTight
in interface VoxelsPredicate
Optional.empty()
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.