I am reaching out as a newcomer to the Anemone Plugin and have encountered some challenges while using it in an algorithm. The objective of the algorithm is to create a web within a rectangle by connecting points across different sides, always following the pattern Left → Top → Right → Bottom → Repeat. It is important that the end point of the last line is the start point of the next.
During the generation of these lines, there are specific surface inputs that should be avoided, categorized into three levels of obstacles. Each obstacle level permits a different amount of lines to pass through. To address this issue, I have attempted to solve the problem using the Anemone Plugin.
The algorithm involves a big for-loop that determines how many times the process should repeat. Within this loop, there are smaller loops for each possible line. Upon a collision, the algorithm for the individual lines should choose a new endpoint for each line and repeat the process until the conditions for all obstacles are fulfilled.
While the approach appears to work correctly for a single obstacle, I am facing challenges when dealing with multiple obstacles. The collision counter increments correctly, but the algorithm doesn’t seem to consider other obstacles, resulting in lines being generated that pass through them. ForumAnemone.gh (100.7 KB)
Additionally, I have noticed variations in results when using an exploded and a packaged cluster, which adds to the confusion.
I would greatly appreciate any insights, suggestions to help troubleshoot and refine my algorithm.
Thank you in advance for your time and assistance.
Use Top View to see this. The number of obstacles, their radius and random seed can be changed, or you can supply your own. The slider wired to DivLength can be reduced. Etc.
P.S. What I failed to do here is detect duplicate segments, which happens when the ‘Iterations’ slider is set too high and the obstacles prevent new solutions… Or something. Clearly it should know when to stop but it doesn’t.
P.P.S. You can see the problem here when the MidPt of all the PLine segments is passed through CullPt(Cull Duplicates). The number 641 is from the ‘Iterations’ slider while 169 is the true number of unique segments.
As @martinsiegrist says, I think your proposal misses a key aspect of the problem:
It is possible to create the points on each side before starting the loop and I had planned to make that change, along with a few others, though I’m not sure they will make much difference. Later today.
Apologies for any confusion. There isn’t an actual continuous polyline in the code. It’s more of a conceptual approach, specifically tailored for the robots plugin. To ensure proper movement, I require a plane at both the starting and ending points. The concept of the continuous line revolves around the idea that the robot carries a spool with a string woven between anchor points.
This necessitates a theoretical continuous polyline this feature is already working in my code, I wanted to point out that it is important to keep that feature. To achieve this, I assign each cluster the endpoint of the preceding line as its starting point within the bigger loop. At the end of the bigger loop, I compile the outcomes of the lines, extracting each start point and the ultimate end point to attain the desired result.
I moved the creation of points on each side out of the Anemone loop to the orange group. The ‘PtsLongSide’ slider sets the number of points on the longest side. The method is slightly more accurate but there is no discernible difference in performance.
Thank you for your Time and very Interesting Approach, this solution is a lot sleeker than my brain dump. But I have a couple of questions because I have never used the IsoVist Ray component in grasshopper.
The final Idea is that I can Imput multiple Obstacles like the example above.
all Red Should have a total of 0 Collisions with lines
all Yellow Objects Should have a maximum Number of 20 Collision
And Green should have a maximum Number of 500 Colission
This is what i tried to do inside my Cluster Packages:
I tried to solve it with a logical and Gate, so if the Line is within the maxmimum number of collisions with all Objects or there is no collision at all, the Line would pass the “Test” and the loop would exit.
But my solution is quite bulky and didnt seem to work properly. In the sense that the counter went up Properly but the Lines were created anyways. I thought this might be becouse of delayed timing of the computation of each “Test”.
That’s called “moving the goal posts”, I’m not interested. You can create obstacles in my model any way you please but they are all treated the same, as obstacles. Not semi-permeable obstacles.
I couldn’t see any of your code without the plugins you used. The IVRay method is familiar to me so my model was a spontaneous vision. End of story.
I’m sorry if it was described in a confusing way (I’ve been working on the project for a while and sometimes that leads to confusing explanations) but I wouldn’t call it moving the goalposts if it was stated in the beginning.
Single Obstacle should be: a Single Level of Obstacles, that was not very clearly stated I apologize.
Thank you for your Insights and Help anyways, maybe I will find a way using IsoVistRay, it seems like a very capable component that has been under my radar.
This is my first Post, and it seems like I can’t edit the original Post so here are some corrections:
This should be: While the approach appears to work correctly for multiple obstacles but only for a single “obsacle Level”.
Example Picture of Obstacle Level(Red can be avoided Fully or be passed through by a defined number of times):