Cut lines from coincident points.

   2924   9   4
User Avatar
Member
4 posts
Joined: June 2017
Offline
I'm learning Houdini for some months and this is my first post on the forum, so hello everyone!
And thank you for the great help you already provided me on my day-to-day learning.

I have a “simple” issue (means simple for you). I've made a structure of points connected by lines. Then I've used a “Copy to Points” SOP in order to copy spheres of various radii on each point of the structure. I used an “Intersection Analysis” SOP to get the intersections from the spheres with the lines of the structure. As result, I get new points that are coincident to the lines (attached picture 1). But they don't actually cut the line : they are just created as simple points and are not connected to the lines. <= This is the issue.
I need to “Blast” the structure's points in order to remove the part of the line between these points and the new points added with the “Intersection Analysis” SOP (attached picture 2).
But as I can't find a way to append/merge/embed theses points onto the structure, the full line disappear (attached picture 3).

So I have the feeling that “there is a node for that”. I'm quite sure this could be done in seconds, but after a night of unsuccessful (and quite frustrating) tryouts, I resolved myself to ask for your advice.
I've linked a .hip file too with my progression so far. Thank you in advance for your help!
Edited by Chaotic_Atmospheres - July 3, 2018 22:26:59

Attachments:
pointsonlines.jpg (523.6 KB)
pointsonline-01.hipnc (194.7 KB)

User Avatar
Member
143 posts
Joined: Oct. 2015
Offline
Hello ,
I don't know if there's an easiest solution…but i found this one .

Benjamin

Attachments:
lines_cut.hipnc (92.3 KB)

User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
In case you are also learning VEX or VOPs, you could avoid the cutting altogether and simply push the points towards their connected neighbours by a certain amount.

int nb = neighbour(0, @ptnum, 0);
vector nb_pos = point(0, 'P', nb);
vector dir = normalize( nb_pos - @P );
@P += dir * @amount;

Attachments:
crossings.hiplc (72.2 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
4 posts
Joined: June 2017
Offline
Thank you Benjamin and Konstantin for your help. I've tried both solutions and I ended up to succeed with the VEX approach of Konstantin.

Benjamin, your solution seemed easier to understand as it didn't involved code, so I tried it first (yes I'm lazy at 1am). But I couldn't find a way to make it work on my setup. I found out the issue : it only works if I leave empty the “Target points” option of the “Copy To Points” SOP. If you try, on your example, to put any point number on the “target points”, you will end up with the same result as my original issue. Maybe it has something to do with the fact that all line aren't cut? (I'm just wondering). Even if, for this project, I'll keep Konstantin's solution, I'll be glad to have your insights if you know what is happening.

Konstantin, your solution with VEX works like a charm, not to mention the fact it is lot more elegant than my tryouts. Everyday I see new reasons to learn VEX more assiduously. Thus, I'm trying to understand your example. I get the overall idea of what it does, even if I'm struggling to understand the meaning of each line separately on the last “Attribute Wrangle” (the part you quoted on your message). Would you mind giving me an idea of what each line does?

Thank you once more for your examples that gave me matter to think (and solved my problem)!
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
I initially was thinking along the lines of Konstantin and was going to do something simple…

But I thought, because you were using spheres you might be looking for applying a variety of different geometric shapes;

The example here allows you to do that.

Green netboxes are your individual groups you set up.

The red netbox is the total combined groups.
Edited by BabaJ - July 4, 2018 20:11:13

Attachments:
pointsonline-03-1.hipnc (260.6 KB)

User Avatar
Member
4 posts
Joined: June 2017
Offline
Thank you BabaJ for your example, it seems like a great solution. However, it doesn't work when I open your file on my computer. The boolean nodes produce no result (no points, no lines, nothing), although it don't give any error message.
If I create a simple boolean with two primitives, it works well, but if I try to use my structure as one of the primitives, I end up with no result. Any idea what happens? A bug maybe?
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
I don't know…I have no problem opening it from the forum as a source.

This is the second time in about 2 months where someone couldn't open a hip I posted.

I'm wondering though…

you see the new nodes I put in after your color5 node?

Well maybe in a new file or your original file on your computer just copy and paste the code I have after your last node where I picked up.

Your original file had a reference to an hda that was not available to me..so houdini ‘embeds’ it. I had no problem working with that…but maybe my re-saving it back causes the problem..but then again…I have no problem opening it from the forum.
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Chaotic_Atmospheres
Would you mind giving me an idea of what each line does?

int nb = neighbour(0, @ptnum, 0);       // neighbour() returns the point number on the other end of each line.
vector nb_pos = point(0, 'P', nb);      // returns the neighbour´s position.
vector dir = normalize( nb_pos - @P );  // both point positions are subtracted to get the direction pointing away from each crossing.
@P += dir * @radius;                    // The direction (which has a length of 1 due to normalization)
                                        // gets multiplied by the pre-defined radius of each crossing and
                                        // is added to the current point position, which is moving all
                                        // points away from the crossings center along the lines.
Edited by Konstantin Magnus - July 5, 2018 04:26:38
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
4 posts
Joined: June 2017
Offline
BabaJ, sorry if I wasn't clear : I can open your file, and everything seems to be as you described (the extra nodes on the red part, etc). It's just that the boolean nodes don't give any result (check picture). So your file seems to be working well, that's the reason why I think it could be a bug on my side.

Thank you Konstantin for the hints! VEX seems always easy and straightforward when explained like this Hope I'll be able to think in a VEX way asap!

Attachments:
nobooleans.png (529.2 KB)

User Avatar
Member
143 posts
Joined: Oct. 2015
Offline
Look
Solution with a bit of vex that should work with any kind of shape and radius
Edited by Benjamin Lemoine - July 6, 2018 08:46:45

Attachments:
shape_cut_lines.hipnc (1.3 MB)

  • Quick Links