Cellular infection growth a la Entagma

   2135   3   0
User Avatar
Member
338 posts
Joined: 12月 2014
Offline
I've been working with growth solvers using nearpoints() with some initial setups demonstrated by the brilliant folks at Entagma. However I'm getting a little stumped when I try to weight the growth in a certain direction. In other words, I'd like like the solver to find nearest points only in the +x direction of the currently infected points. Pointers? Ideas? Thanks!

Solver code:

float radius = 0.075;
int nbrs = nearpoints(0, “infected”, @P, radius);

int cnt = 0;
float accum = 0;

foreach(int nbr; nbrs){
float infection = point(0, “infect”, nbr);

float dist = length(@P - point(0, “P”, nbr));
float weight = 1 - smooth(0, radius, dist);
accum += infection * @Cd.r;


vector nodepos = point(0, “P”, nbr);
v@dir = normalize(nodepos - @P);

cnt++;
}

f@infect = f@infect + accum/float(cnt);
User Avatar
Member
338 posts
Joined: 12月 2014
Offline
Ok so put another way, I need to find the vector between the current point and it's neighbor, and weight the ‘infect’ attribute in a certain direction. I've enclosing a simplified infection solver set up with a more compact algorithm

Attachments:
cellInfectSetup1.hip (174.3 KB)

User Avatar
Member
900 posts
Joined: 2月 2016
Offline
if u use the dot product between two vectors you get a scalar value that tells you how much the vector differ in their direction
User Avatar
Member
338 posts
Joined: 12月 2014
Offline
Thanks, that's the ticket. My implementation isn't the greatest at the moment but it does seem to work, here's an example file

Attachments:
cellInfectSetup3.hip (212.8 KB)

  • Quick Links