Create 2d matrix with different quad widths

Hey vvvvellows!

Quick question. I want to create a 2d matrix out of quads. So far, so easy - since I could just use a LinearSpread and a Cross (2d) Node.
But I want the quads in my matrix to have different widths. To be more specific - I want to use two different widths where the bigger quads are twice as long as the small ones.
If I am not mistaken I cannot use the LinearSpread + Cross (2d) combination anymore and I have to write my own matrix logic. In it I have to check how many quads fit in one row based on:

  • The length of each quad and
  • the estimated grid width

Scenario:
Let’s assume I have a spread of six quads and one row in my matrix can hold exactly six small quads. Now if, for example, the first out of those six quads is twice as large as the other ones I would have to push the last quad of my spread into the next row because the first quad already needs the space of two small ones. And therefore I can only place four small ones into the same row before I move on to the next row…

While this is a very simple example it is worth noticing that I want to deal with a fairly larger and variable spread size in my actual project.

Does anyone have an idea how I could solve that?

Cheers,
dl-110

a fun little sunday puzzle

2d-matrix.v4p (21.7 kB)

Maybe “quadtree” could help you, it depends on how much control on the logic do you need.

Alright!
sunep - I can see what you did there! And thanks a lot for the patch! I was patching something similar until I realized that it is not working exactly the way I wanted. But maybe I should revisit this approach…
Anyhow - it seems that the big quads can only be placed on even slices (0,2,4,6, …) but it should be possible to place them on uneven slices as well - which of course causes a lot more trouble ;)

But again - thanks for the patch and I’ll take it as a foundation for my next trials!

Cheers,
dl-110

Hey lasal!

I don’t think “quadtree” offers me the flexibility I need. There will be a lot of spreadcount changes, animations (quads change their positions), and fading effects…

But thanks - I didn’t have “quadtree” on my radar!

maybe cross (2d) advanced is what you need?

here is an iterative take, works with any number of quad-sizes.
probably a plugin job…

Fit (2d) test.zip (12.3 kB)