sasbom Posted May 20, 2018 Share Posted May 20, 2018 Hey! I was going through some tutorials on growth solvers, and I noticed that a lot of them are driven by the "food" group looking to get "infected" if you know what I mean. I wanted to try and make a growth solver that workes differently, looking instead at the points that are already infected and infecting more from their perspective. A very simple summation of what I'm trying to achieve: 1. List the points around me 2. If they are food, they are candidates 3. Infect only 1 of the found candidates rinse and repeat I've put the code underneath in a point wrangle in a solver, but it doesn't work well. I tried running the command on the seperate food and infected groups but that doesn't seem to improve either. What happens when it doesn't go well: 1. nothing 2. Almost every point gets put into the infected group in 1 framespan and then the solver doesn't do anything anymore. //initialiation of radius to search for, and random seed; float radius = 0.2; float seed = 8008135; //stalking prey (finding a list of points to infect); int neighbours[] = nearpoints(0,@P,radius,5); //hopefully grabbing a random one out of the stack of many; float array_length= len(neighbours); //random number between 0 and the length of the list of neighbours; int targetp = rint( rand(seed) * array_length); //looking up point ID in list of neighbours; int point_to_infect = neighbours[targetp]; //actually infect the point, if it is food; if (point(0,"infection",point_to_infect) == 0){ setpointattrib(0,"infection",point_to_infect,1); }; I haven't any clue what's going on, I got no errors other than a little green line under the local variable "targetp" when it gets created. I've attached my .hip! It might be something else I'm doing wrong. I hope you can help me, thanks in advance, Sasbom active infection.hip Quote Link to comment Share on other sites More sharing options...
Yon Posted May 20, 2018 Share Posted May 20, 2018 you were missing 1) condition to only run on infected points 2) I cannot infect the point that infected me, which you can get around by changing the target seed by time though there is prob a smarter way by removing infected points @ptnum from the candidate array also to iterate correctly in a solver sop you want to fetch the results from last frame and run over that active infection.hip Quote Link to comment Share on other sites More sharing options...
sasbom Posted May 20, 2018 Author Share Posted May 20, 2018 Thank you so very much. This is a great help! Have a nice day/night/whatever! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.