generative modeling for Rhino
I like your example a lot.
I thought you might be interested in a slightly more efficient means to tackle this specific problem.
In the case of an enclosing circle, the radius of the circle will be equal to the distance from the origin to the most distant point. This means the number of sliders can be reduced to two, and that "redundant" solutions where not all points are enclosed will not be generated. I've attached my modification. I think it's a good demonstration of Galapagos or genetic algorithm goal seeking.
Hope it helps,
Hey Thank you Jon :)
That was a great modification of the definition as I had to extend the algorithm for checking the circle to have all the points! But your rule really rules! You're absolutely right as this will definitely make the circle always include all of them! That shows how you can make things complicated and how you can make it easy by thinking more!
Anyway thanks again :) thumbs up
I personally agree, the "thinking more" is an important aspect of using Galapagos effectively. I quite often describe it as "slicing bread with a chain saw" in my presentations if it is used incorrectly. But it is a really powerful tool, and your example is a good one to demonstrate it.
A nice and vivid proverb! I guess checking all possible solutions and picking the best is the right way. Anyway thanks Jon for the help. It was a good lesson :)
Sorry to revive this old thread, but I was wondering if you can help me debug my version of your and Mohammad's algorithm. I am trying to fit a minimum circle on top and bottom of a mesh object (a block from a classical column). I isolate the curve and get some points on the curve to fit the circle onto. However, I just can't seem to be able to get the solver to work. What am I doing wrong?
I feel really dumb. I thought the solver would run automatically and was wondering why it wasn't working :p I started with grasshopper yesterday so I think I will need to spend more time understanding how everything works. One thing I'm still not sure about: do I have to stop the iterations myself or is there a way to get the solver to stop once it has found a useful solution?
I just had another question: is it possible to use grasshopper to actually slice mesh objects into individual meshes? If it is possible to do that, can one then run the mesh repair tools like "Fill Holes" and "Unify Normals" straight from grasshopper?
I am trying to slice the columns mesh that I got from a 3D scan of a temple in Portugal to get the individual blocks in the structure. Then I want to construct simple prismatic elements that have the same contact areas on top and bottom.
On a totally irrelevant note, I must say grasshopper is an awesome tool. I think I will need to take some time (or some courses) to really learn Rhino and Grasshopper because this makes life behind a screen actually exciting! Good job McNeel and Associates.
No shame in asking a question, would be far worse not to ask. We've all had to start from the very start with Rhino/Grasshopper at some time (and if you search through Rhino newsgroups etc, you'll find I've certainly been guilty of similar and I think exceptions to this would be rare). I did stop the solver, you can see it converges pretty quickly for this example.
The mesh repair is interesting. Some functionality of this might be available in Grasshopper (or the Rhinocommon SDK). But as this repair is really a process to run once, I would think it would be just as easy to quickly run the command when you first open the rhino document and identify the problem. It can be a time consuming process, and unless I'm not understanding a work flow, you don't really need it to run every time you reopen the gh definition.
I agree, GH is awesome.
Hey Jon and Others,
Well I've been working on this a bit and I have found a way that will allow you to find a solution much faster. The algorithm is an approximation but I think it is very accurate. I came upon it looking for a solution initially in AutoCAD . The code was in C# but I managed to convert it into a VB component for use in grasshopper (I'm not a good programmer and I can only understand VB). I've attached the setup for everyone to try, if they would like. I've had good results. Let me know what you think.
Of course this solution kind of negates the original intent which was to use the existing components in grasshopper to achieve this and to keep the algorithm visible. I wanted to output the circle within the VB component but I decided to keep that separate.
I've got some other issues which I think I will post under a new thread. Hopefully someone will have a good solution :)
Thanks for all the help,
I'm interesting with this evolutionary solver sample, Can you help me to re-attach Rhino file, cause the file is not found.
Sorry for deleting the files
You can download them now :)
Cool. Thank you Mohammad :)