Split poly line at a point

   27418   5   4
User Avatar
Member
48 posts
Joined: Sept. 2013
Offline
I have a polygon primitive line with points: 0 1 2 3 4.

Is there a cheap way of splitting the primitive at point 2, so that the result is two primitives with the following points?
- 0 1 2
- 2 3 4

I'd also like to be able to split a line at points where an attribute has a specific value.
User Avatar
Member
30 posts
Joined: Sept. 2010
Offline
You can use carve SOP. Check “Second U” and set it at 1. Check both “Keep Inside” and “Keep Outside”. For “First U” you need an expression. To cut at exact point position (on curve) you need to divide 1 (parametric length of the curve) by the number of points, and then multiply this with the number of the point where you want to cut.

Something like this (for an open curve):

1/(npoints(“../” + opinput(“.”, 0))-1) * 9

The last number (9) is the number of the point where the curve will split

npoints(“../” + opinput(“.”, 0)) returns the number of points in the node fed into the first input of the current node
User Avatar
Member
48 posts
Joined: Sept. 2013
Offline
thanks dan.

I should have mentioned it, but I was looking for a method that didn't involve the carve sop. Mainly because I might want to split the line on multiple points all at once in one operation. Using the carve sop means I need some kind of loop.
User Avatar
Staff
727 posts
Joined: Oct. 2012
Offline
The PolyCut SOP (in Houdini 13) can cut curves at specific points, as well as where attributes cross a threshold or change by a certain amount. I've attached a simple example.

Attachments:
polycut_simple.hip (61.3 KB)

User Avatar
Member
48 posts
Joined: Sept. 2013
Offline
now that's exactly what I needed thanks a lot!
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
kinda of late to the party, but this saved me today.. THANK YOU!
-G
  • Quick Links