Hello everyone, this is my first post on this forum even though I’ve been playing with grasshopper for a while now.
While working on a genetic algorithm approach (Octopus) I found myself very unhappy with the performance of the various distance calculations for attractor methods, especially in the case of multiple attractor curves.
So I tryed another approach with which I have had very nice results : instead of computing a distance for each point to the attractors and taking the smallest, I generate an image by plotting the curves, and then blurring them to get a nice gradient around them (influence zone of the attractor). Once the image is generated, one only has to sample it like the component image sampler. (and the cost does not depend on the number of sampling points !)
Attached is a demo definition showcasing my code (which I’m sure is not up to your expectations as I am a complete beginner in Python) . It runs with GH_Cpython because it relies mostly on Matplotlib and PIL.
It is quite taylor made for my purpose, so I don’t know if it will be of any use for anyone else, but I think the idea is nice and gives good results, so it might inspire someone else to develop it or use similar ideas !
Alternative attractor.gh (26.9 KB)