# Percentage of surface area

Hello everyone i am just struggling a bit maybe you guys could give me a hint on how to approach this…

So my goal would to creat a grid of cells that have 63% of the area of the surface they were created on
the top square i draw everything by hand and now i would like to be able to adjust the size of the cells but for them to always keep 63% Area of the surface they lay on

If you change the cells dimensions, then you must change their amount… !
It works better the other way, user input is cell X and Y amount.

Is spacing equally on x and y?
Is the top always without spacing?
Are all the cells always equal?

the goal would be that i can change the amount of cells but combined they stay with an area of 63% of the toal area

so my idea would to try to figure out how much i need to offset a cell that i get the area x 0,63 of the old cell

And specify the number of rows? Otherwise you get all narrow cells that are full height.
As @maje90 asked, what about vertical spacing or distance from top and bottom surface edges?

Incomplete spec…

P.S. Here is a thing that demonstrates flaws in this spec, and some ways of thinking about it.

As you can see, spacing is an issue. If ‘Clearance_H’ is zero, the cell widths consume the full horizontal distance with nothing left for gaps. If ‘Clearance_H’ is too large, the cells may not fit within the original surface. Vertical spacing can be derived but I can’t be bothered.

‘Clearance_H’ too large:

You want the GH code too? How about posting your own next time?

cells_in_rectangle_2021_Jul13a.gh (20.9 KB)

use Scale by 0.63, don’t use offset

OK, this version calculates even spacing horizontally and vertically. The ‘Clearance_H’ problem remains when it is too large.

cells_in_rectangle_2021_Jul13b.gh (26.5 KB)

Kaboom! A bug discovered… Can you find it? Can you fix it?

Found and fixed two bugs. Added yellow group to alert when ‘Clearance_H’ slider (blue group) is excessive by changing surface color from green to red.

cells_in_rectangle_2021_Jul13c.gh (30.4 KB)

panels area ratio.gh (27.2 KB)

BTW

working with areas, that scaling factor should be under square root