algorithmic modeling for Rhino
Hello,
I am having some trouble removing points from inside a large number of circles. I want to remove the points that appear inside of each circle depending on how big the circles each get.
I have tried, Cull, Containment and using area of the circles as a driver for the point selection.
Any thoughts? There are quite a number of points and circles.
Tags:
Thanks of the suggestion - I tried something like that - I am going to try again.
One problem is that the definition sort of freezes when I plug in the points and the curves.
It's analyzing 200k about and about 300 circles. I was wondering if that is having some effect.
The attached file has a C# algorithm which samples the inside/outside relationship using a bitmap for fast lookup. Benefit of this approach is that it fairly easily extends to shapes other than circles. Downside is that it only uses pixel accuracy for the sampling. An improvement would be to draw the shape outlines in a third colour, and switch to expensive inside/outside testing when points end up on these edges.
Sampling 100k points takes about 700ms using this approach. The algorithm also has O(N+M) complexity instead of O(N*M) (where N is the number of circles, M is the number of points), so it scales better to larger data sets.
Nice!
Does GH_MemoryBitmap utilize the LockBits method ?
Yes, but it does much more. It's not as fast as it possibly could be, as I copy the image bytes into a managed array. It's this array that gets read from and written to. If you apply any effects or set any values, you have to call Release(True) when you're done. That copies the data back into the image and unlocks it. If you didn't make any changes, then you must call Release(False) to just unlock the image.
I use GH_MemoryBitmap mostly for applying some effects to small images (making disabled versions of component icons for example) and also in the Image Sampler component.
Let me know if you need any other curves besides circles, I can probably add that quickly enough.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson.
Powered by