_5Example3D

44 views
Skip to first unread message

yasolo...@gmail.com

unread,
Jul 16, 2020, 6:48:46 PM7/16/20
to HAL Q and A
I've been looking through the _5Example3D and am having a hard time understanding how blood vessels are being generated. What is migProb, migration probability? Can someone help me understand the GenVessel and GenVessels functions. Thanks. 

Rafael Bravo

unread,
Jul 18, 2020, 10:50:23 PM7/18/20
to HAL Q and A
No problem, the GenVessels function works in the following way:

A 2D grid of open locations to potentially put vessels into is created called openSptos. 0s on the openSpots grid are used by the function to represent that the location is valid to place a new vessel into, -1s are used to indicate that the location cannot take a new vessel.
A randomly ordered list of indices called indicesToTry is created to decide the order to check spots.
the indices to check are pulled from indiciesToTry in a for loop.
if the position in openSpots has a 0, then a vessel may be placed there with GenVessels, otherwise nothing happens and the next index is tried.
If the vessel ends up being placed, then all positions in a circle centered at the new vessels are set to -1, using the vesselSpacingHood circular neighborhood.
overall this function prevents vessels from being placed close together.

GenVessel works by placing vessel agents in a random path up from the starting position chosen in GenVessels until it reaches the top of the domain.
migProb gives the probability that the vessel won't be placed directly on top of the previous x,y vessel placement position.
if the position should be changed, a von-neumann neighborhood (vnHood2D) is randomly sampled to get the x,y position to put the next vessel component.
this process is repeated until the vessel is entirely placed.

A good way to demonstrate how these functions work is to play around with the values used to set GenVessels in main.

Let me know if you have any more issues understanding.

  
Reply all
Reply to author
Forward
0 new messages