Find Shortest path - clean branch hierarchy

   1930   5   3
User Avatar
Member
385 posts
Joined: July 2018
Offline
So i was experimenting a bit with 'find shortest path' and tried to resolve some problems that occur if you want to work with a clean edge network and not lines on top of lines as the 'any start to each end' method produces. i didn't want to use vdbs.

The main thing that i wanted to solve was to get tapering at the end of all branches and vary their pscale according to the number of branches that stem from each one.

So here are my experiments for anyone interested.

Attachments:
1.JPG (326.5 KB)
2.JPG (335.0 KB)
3.JPG (259.9 KB)
Shortest_path_hierarchy.hip (337.1 KB)

User Avatar
Member
208 posts
Joined: Nov. 2010
Offline
Nice use of shortest path.
User Avatar
Member
385 posts
Joined: July 2018
Offline
some more progress. What i am after is getting the full hierarchy who has what branch. So far i haven't accomplished that exactly but i feel i am close.

there is probably a way that i am not aware of. Any ideas?

Attachments:
1.JPG (146.1 KB)
2.JPG (143.8 KB)
Shortest_path_hierarchy.hip (366.3 KB)

User Avatar
Member
131 posts
Joined: Aug. 2012
Online
One way you could attempt to map hierarchy is to measure the length of each full path, then sort by descending length. Run a For Loop over each path, starting from the longest. Have a second input (Fetch Input) in the loop, collecting all the paths with longer length than current.
if(@length < prim(1, "length", 0)) removeprim(0, @primnum, 1);

Give the current-processed path a unique id prim attribute, as well as a per-point age attribute that increases with distance along path. You can then use Attribute Transfer from the second input to the current path. The id attribute tells you which path this path is a parent of, and the age attribute tells you at which point it starts to branch.
User Avatar
Member
385 posts
Joined: July 2018
Offline
Jikian
One way you could attempt to map hierarchy is to measure the length of each full path, then sort by descending length. Run a For Loop over each path, starting from the longest. Have a second input (Fetch Input) in the loop, collecting all the paths with longer length than current.
if(@length < prim(1, "length", 0)) removeprim(0, @primnum, 1);

Give the current-processed path a unique id prim attribute, as well as a per-point age attribute that increases with distance along path. You can then use Attribute Transfer from the second input to the current path. The id attribute tells you which path this path is a parent of, and the age attribute tells you at which point it starts to branch.

Thank you for the tip! Just to clarify, the process you are talking about is with the find shortest path output? Using all overlapping paths?
the attrib transfer from the fetch input is not very clear to me . The id and age attributes are on the other stream.
Edited by papsphilip - April 29, 2022 08:39:21

Attachments:
Shortest_path_hierarchy.hip (401.7 KB)

User Avatar
Member
1 posts
Joined: Nov. 2017
Offline
papsphilip
So i was experimenting a bit with 'find shortest path' and tried to resolve some problems that occur if you want to work with a clean edge network and not lines on top of lines as the 'any start to each end' method produces. i didn't want to use vdbs.

The main thing that i wanted to solve was to get tapering at the end of all branches and vary their pscale according to the number of branches that stem from each one.

So here are my experiments for anyone interested.


Just wanted to say thank you for this awesome resource! The HIP file you provided was extremely clear and organized. The find shortest path node is awesome but outputs quite messy geo (lines stacked on top of each other), however, you have helped me understand/solve this problem. Thank you! great post
  • Quick Links