Curve intersection problem!

   5859   17   1
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
i have a bunch of curves that i want to cut with a closed curve like a cookie cutter, but curvesect node is not working for some reason.

Attachments:
curve_intersection.hip (236.7 KB)

User Avatar
Member
495 posts
Joined: 7月 2005
Offline
Hi,

what exactly is not working?

If you want to keep the right input (ComboBox->“Right-face pieces”: Keep All).

The intersection points are calculated correctly for me (H17.5.229) indepently of this option.
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Aizatulin
Hi,

what exactly is not working?

If you want to keep the right input (ComboBox->“Right-face pieces”: Keep All).

The intersection points are calculated correctly for me (H17.5.229) indepently of this option.

thats weird, for me this is the result, the intersections are not solved aparently? Just to be clear, i want to keep everything that is inside the curve mask, like the boolean alternative i have in the file
Edited by papsphilip - 2019年7月23日 02:41:15

Attachments:
error.JPG (164.2 KB)

User Avatar
Member
495 posts
Joined: 7月 2005
Offline
ok

I think I got it wrong.

You want to delete all points, which are outside your mask.

Perhaps it will work with boolean too, but one solution (if you have already applied curvesect) is to use the extruded mask to find for every point/prim its number of intersections with the mask(box) of a ray from itself to any direction (long enough). If this number is even, the point should be outside, so you can remove it.

Check my attachement …
(edit: polyexpand before extrusion and smaller tolerances for the intersection function tends to give more stable results - if the mask is non-convex)
Edited by Aizatulin - 2019年7月23日 17:26:25

Attachments:
curve_intersectionY.hipnc (252.1 KB)

User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Aizatulin
ok

I think I got it wrong.

You want to delete all points, which are outside your mask.

Perhaps it will work with boolean too, but one solution (if you have already applied curvesect) is to use the extruded mask to find for every point/prim its number of intersections with the mask(box) of a ray from itself to any direction (long enough). If this number is even, the point should be outside, so you can remove it.

Check my attachement …
(edit: polyexpand before extrusion and smaller tolerances for the intersection function tends to give more stable results - if the mask is non-convex)

thanks!! i tweaked it a little bit added a final fuse and polyexpand at the end to make each piece a surface and it works like a charm, i hope this workflow is not going to crash when i plug in thousands of curves and masks
Edited by papsphilip - 2019年7月26日 15:40:27

Attachments:
curve_intersection.hip (191.8 KB)

User Avatar
Member
495 posts
Joined: 7月 2005
Offline
Sure ,

For me it works even better (with less artifacts), if I put a “convert line node” in front of the first input of “pointwrangle1” and loop over prims (instead of points) in “pointwrangle1”, but I'm not sure if this will increase/decrease the performance.
“Convert line” converts each edge to a separated prim, which should be an advantage, because now each center point can determine, if a prim is outside/inside.
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Aizatulin
Sure ,

For me it works even better (with less artifacts), if I put a “convert line node” in front of the first input of “pointwrangle1” and loop over prims (instead of points) in “pointwrangle1”, but I'm not sure if this will increase/decrease the performance.
“Convert line” converts each edge to a separated prim, which should be an advantage, because now each center point can determine, if a prim is outside/inside.

ok i'll try that and see what happens when i import a whole network of curves. i'll post the results here
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
So i've messed around some more and i've bumped into a weird bug? multiple curve intersections! not working, only if its selfintersections.

Attachments:
curve intersection.hip (156.6 KB)

User Avatar
Member
899 posts
Joined: 2月 2016
Offline
hi have a look at the hip file…

it works by getting the intersecting points, and reconstruct the polylines using the sourceprim and sourceprimuv attributes..

It seems working, but I feel there should be a SINGLE NODE solution for that.. I never understood how to make work the mofo of a node that is the polycut.
Edited by Andr - 2019年7月28日 11:18:44

Attachments:
curve intersection_morelines.hiplc (163.2 KB)

User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Andr
hi have a look at the hip file…

it works by getting the intersecting points, and reconstruct the polylines using the sourceprim and sourceprimuv attributes..

It seems working, but I feel there should be a SINGLE NODE solution for that.. I never understood how to make work the mofo of a node that is the polycut.

wow thanks!! that was way too complex…one node setup sounds sweet. I'll test it some more, but can you explain a bit more the basics of the vex you wrote? i understand most of it but it would help to know what each step does (still learning)

if we could find some documentation on the mofo of a node it'be nice.I've only used it for loop cuts on quads, never on something more complex.
User Avatar
Member
899 posts
Joined: 2月 2016
Offline
Yes it's complex, and shouldn't be… probably there's a node that I'm not aware of that does it already. That polycut I guess..

Anyway this is the logic of the proposed setup:
It uses the sourceprimuv attribute outputted by the intersection analysis.
This attribute tells you at which intrinsic UV position the intersecting point is located on the primitive. So a sourceprimuv value of .25 tells you that the point location is at 1/4 of the total length of the polyline. Range is 0-1.

So you have all the intersecting points with the prim number of origin (sourceprim attrib) and the intrinsic UV position of the cut (sourceprimuv attrib).
You just need to merge the intersecting points back with the 2 end points of each primitive. Being end points, you already know their sourceprimuv value: you can hardcode 0 and 1. (that's what the left branch wrangle does)

After you merge the points, you run a for-loop using the sourceprim attrib (“prim”) as iterating class.
On each iteration you are presented with the ends point and the intersecting point of a single primitive.
You just need to re-sort the point number of the points by using their sourceprimuv attribute, so that you have a nicely ordered point numbers. Append the add node to reconstruct the line following the point order.
Edited by Andr - 2019年7月28日 14:54:53
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Andr
Yes it's complex, and shouldn't be… probably there's a node that I'm not aware of that does it already. That polycut I guess..

Anyway this is the logic of the proposed setup:
It uses the sourceprimuv attribute outputted by the intersection analysis.
This attribute tells you at which intrinsic UV position the intersecting point is located on the primitive. So a sourceprimuv value of .25 tells you that the point location is at 1/4 of the total length of the polyline. Range is 0-1.

So you have all the intersecting points with the prim number of origin (sourceprim attrib) and the intrinsic UV position of the cut (sourceprimuv attrib).
You just need to merge the intersecting points back with the 2 end points of each primitive. Being end points, you already know their sourceprimuv value: you can hardcode 0 and 1. (that's what the left branch wrangle does)

After you merge the points, you run a for-loop using the sourceprim attrib (“prim”) as iterating class.
On each iteration you are presented with the ends point and the intersecting point of a single primitive.
You just need to re-sort the point number of the points by using their sourceprimuv attribute, so that you have a nicely ordered point numbers. Append the add node to reconstruct the line following the point order.

thanks for the detailed walkthrough!
User Avatar
Member
495 posts
Joined: 7月 2005
Offline
Have you tried intersectionstitch already? This should probably work.
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Aizatulin
Have you tried intersectionstitch already? This should probably work.
nope, not yet but i'll take a look
User Avatar
Member
385 posts
Joined: 7月 2018
Offline
Andr
Yes it's complex, and shouldn't be… probably there's a node that I'm not aware of that does it already. That polycut I guess..

ok, s#$%t that worked…intersectionstitch was the ONE NODE solution we were talking about, i just plugged in the curves on the first input and done. so case closed i guess
User Avatar
Member
899 posts
Joined: 2月 2016
Offline
Aizatulin
Have you tried intersectionstitch already? This should probably work.

oh thanks!
User Avatar
Member
28 posts
Joined: 11月 2013
Offline
Alternatively you could use the triangulate2d node for stuff like this.

Attachments:
curve_intersection_tria2d.hip (142.3 KB)

User Avatar
Member
385 posts
Joined: 7月 2018
Offline
arjanM
Alternatively you could use the triangulate2d node for stuff like this.
thanks! i'd be cool to compare which method is faster.
  • Quick Links