Grasshopper

algorithmic modeling for Rhino

Hi All,

I have a list of numbers, say they r generated as distances from an attractor point, is there a way to cull even/Odd numbers only? 

bibo

Views: 24725

Replies to This Discussion

Like every thing in GH there is more than one approach to this
1) Cull Pattern component will allow you to do this. With a pattern of two booleans either False True or True False.
2) Cull Nth when set to 2 will cull every other integer so to get Odd Integers shift the list one place first.

And Dispatch do the same thing.
Hi Danny and Alpha.

Thanks a lot for your reply.

You haven't got my point. My list is NOT listed odd - even-odd-even, so a cull pattern won't work, its just a list of numbers where I have odds and evens mixed up, and I want to cull only Odds.

May be I wasn't that clear, here is what I want to do:
I have a surface where I have openings on it using image mapper, creating 2000 different circles according to the image intensity, and I want to optimize that number a bit, so I rounded up the number to the nearest tenth, so I got 14 different values for all the circles, I need to cull the odd ones!, I need to cull to ODD ones only and give it the value of the closest even number for less opening sizes.

bibo
Bibo,

have you tried something like this?


Let me know if this makes sense.

Best,
Tobias
Hi Tobias,

Thanks for your reply, Will try it first thing in the morning and will let u know

regards

bibo
Had to use this method too, i'm not sure what "mod" does, can you explain? thank you
Hello Tobias,

your method works fine with randoms, but it didn't work out with my list, dunno why. it returns all numbers as 0.

I have attached the file, I will really appreciate any body's help.

regards

bibo
Attachments:
It will only work with whole numbers. I suggest multiplying by 10 before the Mod f(x) and then dividing after if you are looking for even and odd decimals. Sorry about confusion earlier i should r.t.f.q. better in future. There should be a user's experience level flag at the beginning of the post so that you know to look past the obvious :)
Hi Danny

Thanks for the multiply hint!


bibo
Just incase anyone else mentions it. You could also do 0.2 in the f(x) component but there does seem to be a rounding issue with this method so I still think the multiply by 10 option is more reliable.
thanks a lot Danny.. that was really helpful!

bibo

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