Find Shortest path - clean branch hierarchy
2126 5 3- papsphilip
- 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.
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.
- kevinthebright
- Member
- 208 posts
- Joined: Nov. 2010
- Offline
- papsphilip
- Member
- 385 posts
- Joined: July 2018
- Offline
- Jikian
- Member
- 141 posts
- Joined: Aug. 2012
- Offline
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.
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.
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.
- papsphilip
- 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
- KyleKerr
- 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