Forum

Getting Subspreads with varying BinSize-Count


#1

It must be easy, but I’m pretty lost in mathematics here.

I have a Spread that consists of 2d-Vectors, with varying BinSizes, and varying BinSize-Count. I only want to keep the 2 Bins with the biggest sizes, and get rid of the rest.

The Problem is, the varying BinSize-Count. It could be 2 or 20.

Maybe this example helps to clarify my question:

Spread A has Count of 422 with 3 BinSizes: 11, 105 and 95. I want to keep those Slices of the 2nd and 3rd Bin.
Next Frame the Spread has a Count of 432 with 4 BinSizes 108, 14, 4, 90, and I only want to keep the 1st and 4th Bin.

That’s the sample-patch, just to show what I got so far.

sorting_example.v4p (10.0 KB)


#2

does this sorting example solves your problem?

ist just a sort of the bin Counts and then get-slicing the two biggest slice Counts…sorting_example2.v4p (13.7 KB)


#3

Alex was faster, but here you go anyway

sorting_example3.v4p (8.6 KB)


#4

Thank you guys! Made my day!