BoxAccumulator
-
android
class BoxAccumulator
A helper class for accumulating the minimum bounding boxes of zero or more geometry objects. In colloquial terms, this can be used to find the smallest Box that contains a set of objects.
Summary
Public constructors |
|
|---|---|
|
Constructs an empty |
android
|
BoxAccumulator(box: Box)Constructs a |
android
|
Public functions |
||
|---|---|---|
BoxAccumulator |
Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
add(mesh: PartitionedMesh)Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
add(other: BoxAccumulator?)Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
add(parallelogram: Parallelogram)Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
open operator Boolean |
android
|
|
open Int |
hashCode() |
android
|
Boolean |
isAlmostEqual(Compares this |
android
|
Boolean |
isEmpty()Returns true if this |
android
|
BoxAccumulator |
populateFrom(input: Box?)Resets the |
android
|
BoxAccumulator |
reset()Reset this object to have no bounds. |
android
|
open String |
toString() |
android
|
Extension functions |
||
|---|---|---|
BoxAccumulator |
BoxAccumulator.add(rect: RectF)Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
Boolean |
BoxAccumulator.getBounds(outRect: RectF)Fill the given |
android
|
BoxAccumulator |
BoxAccumulator.add(rect: MutableRect)Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
BoxAccumulator |
BoxAccumulator.add(rect: Rect)Expands the accumulated bounding box (if necessary) such that it also contains |
android
|
Public constructors
BoxAccumulator
BoxAccumulator(box: Box)
Constructs a BoxAccumulator, populating the to accumulated bounding box from box.
Public functions
add
fun add(box: Box?): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains box. If box is null, this is a no-op.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun add(mesh: PartitionedMesh): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains mesh. If mesh is empty, this is a no-op.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun add(other: BoxAccumulator?): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains other. If other is null, this is a no-op.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun add(parallelogram: Parallelogram): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains parallelogram.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun add(point: Vec): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains point.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun add(segment: Segment): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains segment.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun add(triangle: Triangle): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains triangle.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
isAlmostEqual
fun isAlmostEqual(
other: BoxAccumulator,
tolerance: @FloatRange(from = 0.0) Float
): Boolean
Compares this BoxAccumulator with other, and returns true if either: Both this and other are empty Neither this and other are empty, and their boxes are almost equal per Box.isAlmostEqual
isEmpty
fun isEmpty(): Boolean
Returns true if this BoxAccumulator is not empty; this is equivalent to checking if the box property is null.
Note that a zero-area Box is not considered empty, as a Box contains its boundary; so isEmpty will return false even if you have added only a single point to the BoxAccumulator.
populateFrom
fun populateFrom(input: Box?): BoxAccumulator
Resets the BoxAccumulator instance to contain just input. If input is null, the instance will be reset to empty.
Returns the modified instance to allow chaining function calls.
A BoxAccumulator can be efficiently set to the same values as another BoxAccumulator with populateFrom(other.box).
| Returns | |
|---|---|
BoxAccumulator |
|
reset
fun reset(): BoxAccumulator
Reset this object to have no bounds.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
BoxAccumulator |
|
Extension functions
add
fun BoxAccumulator.add(rect: RectF): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains rect. If rect is null, this is a no-op.
This is functionally equivalent to, but more efficient than: add(ImmutableBox.from(rect))
| Returns | |
|---|---|
BoxAccumulator |
|
getBounds
fun BoxAccumulator.getBounds(outRect: RectF): Boolean
Fill the given RectF with the bounds of this BoxAccumulator, returning whether or not the object was actually overwritten.
add
fun BoxAccumulator.add(rect: MutableRect): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains rect. If rect is empty, this is a no-op.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
BoxAccumulator |
|
add
fun BoxAccumulator.add(rect: Rect): BoxAccumulator
Expands the accumulated bounding box (if necessary) such that it also contains rect. If rect is empty, this is a no-op.
Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
BoxAccumulator |
|