I’m trying rotate a group of shapes to maximize unbroken connections to an external point (kind of simulates views). Each external surface has been given a random amount of points and later ill run an evolutionary study rotating the group so the most unbroken connections are made. However, as can be seen in the script attached I’m confused why only some of the points are connecting.
I’ve been able to extract some of the correct points by testing how many of the lines have intersections and I’ve culled anything more than 0 thinking that would just leave all the uninterrupted lines. I’m pretty new at grasshopper and posting in here so please correct me if I’ve made any mistakes.
You can simply connect the two Gene Pool sliders to the Genome input of a Galapagos Evolutionary Solver component. Its fitness should be the difference in number (list length) of your initial and remaining lines.
Set to “maximisation”, Galapagos will try to find the configuration with the highest number of uninterrupted lines.
The longer you run it, the more optimized the result should be.
In my opinion, it makes no sense to do this part statically, since you would have to change the number of sliders each time you vary your brep and its number of faces changes.
Instead you can do this:
That said, this doesn’t make much sense. Your randomizing the number of points on each face, but try to find the best rotation with the maximum number of points/lines.
I hope you see the conflict here.
I guess, it would be better to test each face with a fixed number of sample points to get a more conclusive result.
I would go so far as to say that you could probably reduce the simulation to only checking the face vertices and maybe the face center point? Up to you.
Thanks for this! I was more worried about the unbroken lines though, the populate 2D is just serving as a placeholder.
My main concern was that of all the lines from all those points not all of the correct lines (lines that are uninterrupted connecting to the point on the outside) are being produced. The final node (list item) is only producing 12 continuous lines where it is clear that there should be at least double if not triple the amount. The goal is to cull any line that has an intersection and keep all those that are continuous from the Line node at the start of the group.
Cheers.
I think you need to take care of some data structure mismatches first, for instance here you have 12 Brep Faces to populate with points, but are providing 13 quantities, which means the very same last face is populated two times:
the second thing is about scaling the points, which I would think might work well because you are interested just in the external faces, but points very close to corners can be pushed out just the tiny amount they need to actually be reacheable by a non-intersecting line just because they are hovering out of the surface itself…
I would instead embrace the thing that all those lines will touch the Brep, so all of them should have just 1 intersection point to be considered “ok”
at the same time, you are using the Line|Brep intersection component, but take care that Lines are infinite rays in that regard, so they will all probably intersect your Brep many times regardless of their start/end point: you want to use Brep|Curve intersection instead
with the very same starting data (removed one slider from Gene Pool to match the Surfaces) you count 78 “good lines”