Random pairs with predefined maximum & product

Hi everyone,

I am trying to create a sketch which will serve as a diagram for possible ways to build on a site within given legal parameters. The parameters are maximum area for foot print and proximity to the boundary…for now (more legal restrictions to be tackled later).

I have made a start, and have got quite close.

My main question is how to randomly create a rectangle whose area is a set number and sides are no greater than a set number. Currently I am generating one random number within a domain (0 to max allowed) side x, and then dividing the known area to find side y.

This gives me many possible solutions, however, side y is not restricted and can therefore extend beyond the site boundary. To correct this I used a stream gate to disallow values which are too big. I’m sure however that there must be a better way.

I tried making the domain for generating the first number limited at both ends, this does seem to work but I can’t derive the formula for that starting number.

site analysis_Rev A.gh (19.3 KB)

Any suggestions will be gratefully received :slight_smile:

Suggestions:

  1. Don’t use a plugin when a standard component will do the job perfectly well:
    missing

  2. To identify data flow, rename outputs and inputs but don’t rename components because it hides their function (Subtraction, Division, etc.).

P.S. Using zero as the minimum for your Random domain isn’t very realistic. In addition to maximum, there should be a reasonable minimum for both X and Y dimensions.

Hope it helps…


site analysis_re.gh (23.1 KB)

1 Like

Thanks for your suggestions, duly noted. I have revised the uploaded grasshopper sketch. Didn’t intend for that pufferfish node to be there!

Hi HS_Kim,

I’m not sure I understand what it is you’ve done. Could you explain a little please?

Thanks!

You can dress this up all you like by adding an offset boundary or centering it on a lot or playing around with deriving the ‘max_side’ input from a lot size and boundary parameter but this is the basic idea:


Valid_XY_pairs_2020Apr22a.gh (11.4 KB)

1 Like

Thanks Joseph, from your post I have taken the idea of creating many random numbers, knowing that not all will resolve and make valid pairs. After doing this, I am taking one valid pair to create the final form. I can then change the seed and see many different options. Thanks

Just remember that changing the seed alone doesn’t give you all the possibilities. You can select any of the valid pairs for each seed value.