struct

PrismatIQ::VBox

Inherits Struct < Value < Object

Constructors

new(y1 : Int32, y2 : Int32, i1 : Int32, i2 : Int32, q1 : Int32, q2 : Int32, count : Int32 = 0)

Class methods

quickselect(arr : Array(Int32), k : Int32, rng : Random::PCG32 = Random::PCG32.new) : Int32

Quickselect algorithm to find k-th smallest element in O(n) average time. Uses in-place Lomuto partitioning to avoid allocations. WARNING: Mutates the input array in-place.

Instance methods

average_color(histo : Array(UInt32)) : Color
average_color_rgb(histo : Array(UInt32)) : RGB
count
i1
i2
priority
q1
q2
recalc_count(histo : Array(UInt32)) : VBox
split(histo : Array(UInt32), rng : Random::PCG32 = Random::PCG32.new) : Tuple(VBox, VBox)
volume
y1
y2