Grasshopper

algorithmic modeling for Rhino

Not strictly a GH question.. if I have a list of numbers, how might I "compress" the list to bring each value closer to the total average.  Not remapping but "Flattening," so to speak?

It's such simple mathmatical problem but i just cant figure it out.

Thanks 

Views: 708

Replies to This Discussion

Hi Matt,

This will bring your values closer to the average.

Attachments:

Perfect thank you!

I'm not sure i really understood your question. Just use the remap numbers component.

hehe my bad sorry

haha no worries!

yep I think it is technically remapping but the remap component alone still keeps the relative differences between the values, Ethan's solution is almost what I need but yours looks intriguing so I will have a look.

Sounds like remapping to me - "Flattening" has an entirely different meaning in GH.  Maybe "squish" is a better technical term?  (re-posting because I left out the 'Bounds (Bnd)' component to get the actual domain of the random numbers)

Details, details!  Too hasty in my reply...

I had reversed the inputs for creating the new domain.  :(  Was puzzled that the two rows of points didn't seem to align as expected and shocked when I connected the two sets of points with lines that crossed in the middle!?

They still don't align unless you shift the second row in X due to the average (48.438 in this case) being different than the middle of the original domain (50), but they are now spaced proportionally as expected.

P.S.  Ethan's code and mine produce different results, which is interesting...?

Attachments:

Sorry I deleted my last reply because it made no sense! Here is a more clear example i hope..

Trying a different approach but looking for a way to "merge" the two lists of values corresponding to the pipes lengths while maintaining control. So for example in 0-1, 0 would the the image on the left, 1 the right and 0.5 in between

Attachments:

This is my response to your deleted question - it made sense to me.  I used two 'Random Reduce' components with inverse values from zero to one ("Variable X" slider control) applied separately to the lengths of two lists (so the lists can be of different lengths).

This simple illustration plots points in two separate ways: "Pan" and "Mixed", which affect the X coord while the mixed list results define the Y coord:

I'll look at your new code as time permits... :)  Maybe you'll beat me to it?

Attachments:

Interesting stuff!

And yes don't worry I got it thanks, it was so simple haha .. oh dear.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service