Jump to content

Find the center of a deforming tube with Vex


midicon

Recommended Posts

This is probably not as hard as I think but I'm trying to find a way to draw a line down the center of an animated object using vex. I have a tube that is a cache and it is deforming. The points and polys don't change. I want to create a curve that goes directly down the center of the tube. I was successful by manually deleting some poly loops, and using a divide node with remove shared edges and then packing the shared faces then using an add to connect the center points, this is a quick and DIRTY way that worked. But I would like a more robust procedural way of doing this, if I had a lot of objects this way would be a pain. I have attached a .hip for if someone would like to help me out with this it would be much appreciated thanks in advance.    

Rob

FindthecenterTest.hip

Link to comment
Share on other sites

Hey Thanks for taking a stab at this! That is a really interesting solution. and it works for this example. But if I changed the geo it wouldn't work. I was wondering if there is a way that I could do it with a vol. My idea is (I just don't know the proper vex function), scatter points in the vol of the object and find the center line of the vol and push the points to the center line. Is there a function for this?? or I was thinking maybe find the center of the edge rings and then addpoint to the center of the edge ring. But Then I don't know the vex function to get the center of each edge ring. Let me know if these Ideas can help find the solution! thanks for your help Aragatory.

 

Rob 

Link to comment
Share on other sites

I have an imperfect solution, but it's very close, and should at least be workable. This is using a tool from the Qlib toolset called group_edge_loop.

First group an edge ring of the tube (Select first edge then hold A and middle mouse click to select the whole ring). This part could use proceduralizing, I'm not sure the best way to do this though.

Then use group_edge_loop_ql SOP to create groups of every loop. Promote to point group and then use pack SOP to get a centroid point for each loop.

The group_edge_loop_ql SOP doesn't seem to resolve the loops on the caps correctly, so I'm removing the end points from the line.

FindthecenterTest_v02.hipnc

Edit: In regards to Aragatory's question above, this will only work with a tube.

Edited by coltonmil
Link to comment
Share on other sites

If it’s only ever running over a tube you could easily make my solution fully procedural by linking the group by range and vex to the number of divisions. 

For some thing more complex a volume and attribute from volume might be the way to go. 

Link to comment
Share on other sites

Not that it solves your problem, but here is a clarification of the problem you're trying to solve:

https://doc.cgal.org/latest/Surface_mesh_skeletonization/index.html

At least you have the name of the problem, and one implementation in C++ / CGAL. I'm working on something related, (CGAL + Houdini) maybe it's not that hard to offload some work to CGAL..

Link to comment
Share on other sites

12 hours ago, ItsMeM said:

if you need to stay with a tube, maybe this will work?

FindthecenterTest_vex.hip

Hey thanks for these two great solutions!! Both ideas work. This is pretty much what I had in mind! The only thing that is a cheat per-say is that imagine this is a cache so there isn't a curve to resample so get the curveu attr as easily as you did... but it looks like the only reason you did that was to get the correct order of the points and I think you can come up with this after the wrangle.

The  whole idea is that there is a human body 4 limbs and a torso and I find the center points of each limb and torso(basicallt creating center curves through the model) without splitting the model. I wanted to get this to work on a tube as a human character is basically cylinders. with this solution I would still have some work to do in splitting the mesh and find the rows and colls. This is a great step in the right direction, thank you for this! 

Rob  

Link to comment
Share on other sites

  • 7 months later...

 

On 2/2/2018 at 10:32 PM, Noobini said:

I deliberately mangled the tube up to make things harder...got so close...

(refrained from calling it testtube centre)

ok, DQ due to being non-VEX.

TubeCentre.jpg

vu_tubecentre.hipnc

 

On 2/3/2018 at 3:04 AM, ItsMeM said:

clooose, just one step away.. Sort pts by gradient that you can get in resample (curveu)

 

If you don't have the original geometry and therefore no access to that initial resample. This should work.

 

 

vu_tubecentre_end_bit.hipnc

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...