How to extracting the centerline of a 2D Plane

   770   5   1
User Avatar
Member
13 posts
Joined: July 2021
Offline
Hello everyone,

I am a beginner with Houdini, and I have encountered a problem. I want to batch extract the centerlines of several 2D planes. After looking at other answers, I used the Labs Straight Skeleton 2D node to perform the extraction, but the result is not smooth enough, and the lines are not straight enough. What methods can I use to make the lines straighter?

Attachments:
what I want.jpg (190.3 KB)
Now.jpg (163.3 KB)

User Avatar
Member
331 posts
Joined: Nov. 2013
Offline
Given a starting edge, if you know the geometry will follow exactly that topology it's somewhat straightforward to walk along each pair of edges and find the center point.
Edited by antc - Aug. 30, 2024 10:20:19

Attachments:
computepath.hipnc (653.4 KB)
path.png (21.0 KB)

User Avatar
Member
143 posts
Joined: June 2024
Offline
You can also take two boundary curves (with the same number of points), sort the order of the vertices and the point numbers so that they go in the same direction, and make a blendshape between them with a coefficient of 0.5. This is if you don't want to deal with VEX
User Avatar
Member
13 posts
Joined: July 2021
Offline
安特
Given a starting edge, if you know the geometry will follow exactly that topology it's somewhat straightforward to walk along each pair of edges and find the center point.
Thank you so much!!!!!!!!!
User Avatar
Member
13 posts
Joined: July 2021
Offline
加尔
You can also take two boundary curves (with the same number of points), sort the order of the vertices and the point numbers so that they go in the same direction, and make a blendshape between them with a coefficient of 0.5. This is if you don't want to deal with VEX
Thank you very much for your response. I will give it a try. I really appreciate it.
User Avatar
Member
331 posts
Joined: Nov. 2013
Offline
Ok I guess this kind of got stuck in my head lol. Here's a more general solution that can handle multiple regions, overlapping sections and doesn't need any input edges to get started. It also identifies regions with more than one solution and ignores them rather than erroring. Make sure that all the input points are at integer grid locations or it won't work.
Edited by antc - Sept. 2, 2024 18:17:50

Attachments:
compute_paths.hipnc (212.1 KB)
compute_paths.png (49.0 KB)

  • Quick Links