BoxAccumulator


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 BoxAccumulator

Constructs a BoxAccumulator, populating the to accumulated bounding box from box.

Public functions

BoxAccumulator
add(box: Box?)

Expands the accumulated bounding box (if necessary) such that it also contains box.

BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains mesh.

BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains other.

BoxAccumulator
add(parallelogram: Parallelogram)

Expands the accumulated bounding box (if necessary) such that it also contains parallelogram.

BoxAccumulator
add(point: Vec)

Expands the accumulated bounding box (if necessary) such that it also contains point.

BoxAccumulator
add(segment: Segment)

Expands the accumulated bounding box (if necessary) such that it also contains segment.

BoxAccumulator
add(triangle: Triangle)

Expands the accumulated bounding box (if necessary) such that it also contains triangle.

open operator Boolean
equals(other: Any?)
open Int
Boolean
isAlmostEqual(
    other: BoxAccumulator,
    tolerance: @FloatRange(from = 0.0) Float
)

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

Boolean

Returns true if this BoxAccumulator is not empty; this is equivalent to checking if the box property is null.

BoxAccumulator

Populates this BoxAccumulator with the same values contained in input.

BoxAccumulator

Reset this object to have no bounds.

open String

Public properties

Box?

The currently accumulated bounding box, which may be empty

Public constructors

BoxAccumulator

Added in 1.0.0-alpha02
BoxAccumulator()

Constructs an empty BoxAccumulator

BoxAccumulator

Added in 1.0.0-alpha02
BoxAccumulator(box: Box)

Constructs a BoxAccumulator, populating the to accumulated bounding box from box.

Public functions

add

Added in 1.0.0-alpha02
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
BoxAccumulator

this

add

Added in 1.0.0-alpha02
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
BoxAccumulator

this

add

Added in 1.0.0-alpha02
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
BoxAccumulator

this

add

Added in 1.0.0-alpha02
fun add(parallelogram: Parallelogram): BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains parallelogram.

Returns
BoxAccumulator

this

add

Added in 1.0.0-alpha02
fun add(point: Vec): BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains point.

Returns
BoxAccumulator

this

add

Added in 1.0.0-alpha02
fun add(segment: Segment): BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains segment.

Returns
BoxAccumulator

this

add

Added in 1.0.0-alpha02
fun add(triangle: Triangle): BoxAccumulator

Expands the accumulated bounding box (if necessary) such that it also contains triangle.

Returns
BoxAccumulator

this

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

isAlmostEqual

Added in 1.0.0-alpha02
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

Added in 1.0.0-alpha02
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

Added in 1.0.0-alpha02
fun populateFrom(input: BoxAccumulator): BoxAccumulator

Populates this BoxAccumulator with the same values contained in input.

reset

Added in 1.0.0-alpha02
fun reset(): BoxAccumulator

Reset this object to have no bounds. Returns the same instance to chain function calls.

toString

open fun toString(): String

Public properties

box

Added in 1.0.0-alpha02
val boxBox?

The currently accumulated bounding box, which may be empty