#random rectangle partitioning
48 messages · Page 1 of 1 (latest)
are the coordinates integers?
atleast n rectangles
thats it
it can be a little more
the naive solution is recursively splitting rectangles along the x or y axis
but that can't generate a lot of partitions
that are more complex
Please show the original problem, exactly as it was stated to you, with the entire original context. A picture or screenshot is best. If the original problem is not in English, then post it anyway! The additional context might still be helpful. Do your best to provide a translation.
maybe a bit more context behind this? i assume this is a programming task
?
yes
I am making a puzzle game played on a rectangular partitioning grid
i found some answers for this online
https://stackoverflow.com/questions/71777511/divide-rectangle-in-random-sized-smaller-rectangles
here, a p5.js solution is provided
in the first one the answer was specifically avoiding it
yeah... neither the second or first one can generate this
the first one implemented one specific case
but there's more than one of these rectangular partitioning that aren't just made by horizontal/vertical splits
i did some research on this
weird idea: what if you do the naive solution but then repartition some rectangles that are along the same axis?
like this
turn the orange and part of a purple rectangle into one (blue outline) and the rest of the purple one just keep as another rectangle
although i cannot guarantee that this will generate every pattern ever
hm
this is the most basic one that can't be generated by the naive solution
i wonder if its possible with that technique
hm
ok yes it is possible cause what you would do is
have vertical lines at x=1 and x=3
have horizontal lines at y = 1 and y = 3
then merge some stuff
and you get that
not a bad solution but I feel like there has to be something more elegant
.close