Hello, I have set of curves I need to separate between 3 categories straight, diagonals and horizontal I went though this thread Sort lines by horizontal vertical and diagonal directions , but still it doesn’t work with the curves I have .Appreciate any ideas how I could solve this .Attached are the sample isolated curves in rhino meters. Thanks!
Sample curves RH7.gh (12.0 KB)
Well, they aren’t exactly vertical or horizontal but maybe this is what you’re looking for…
Sample curves RH7-b.gh (21.4 KB)
Perfect , Exactly what am looking for ,Thanks Ethan!
I couldn’t use Ethan’s (@akilli) solution because I don’t have that plugin.
So I did this. Expression on DProd output is: round(abs(x),1)
Green group has the curve segments in three branches: vertical, diagonal and horizontal.
curve direction_2023Dec25a.gh (28.4 KB)
Thanks Joseph for this solution, I have isolated small set of curves before for help , but when I apply to other set of curves that I have it doesn’t segregate the 3 categories clearly .its the same case with the solution by @akilli .I was asking if maybe there is additional steps I need to do first before applying this sorting solution to other batch of curves?. Thanks for you’re time !
re_curve direction_2023Dec25a.gh (893.5 KB)
Yeah, that’s because none of these curve fragments are oriented in the ‘X’ (or ‘Y’ or ‘Z’) direction.
I’ve tried a few ideas but don’t have a solution yet…
P.S. Here is a thing that sorta kinda works using the longest line fragment as a reference vector instead of ‘X’. Using the shortest fragment by not reversing the input to List Item after Sort ‘A’ yields a similar result.
curve direction_2023Dec25b.gh (47.4 KB)
Tough problem, in part because the structure is not planar.
You could also extract the vector, reverse the vector that have x, y or z negative. Then “cluster”“group” vectors to get the groups (like what was done by @akilli )
Vectors direction looks like that, they are on a unit (mandatory) sphere
curve direction_LD.gh (43.1 KB)
I was going to post this almost identical thing
re_curve direction_inno.gh (910.4 KB)
the issue I see with this, as @laurent_delrieu just noted, in this particular case we are “lucky” that vectors apper to be “nicely separated” into visibly different groups, so there’s for sure a threshold -as low as it might be- that will make Point Groups work
but whenever you will have more vectors, maybe more evenly distributed, they will start to belong to the very same group all together
I’m wondering how that situation can be dealt with
@inno using some clustering could help has there is no distance but number.
Cluster from Wizard seems to work but has no indexes !!!)
Or K mean clustering
This works better using the first set of “curves”. Changed pDecon output from ‘Y’ to ‘X’ and increased the slider ‘Distance’ value.
But now it fails using the second set of curves. Would be nice if it adapted automagically?
Good catch, I have some problem to find a good solution. It seems obvious but it isn’t
Doing this seems to work, but for how long ?
curve direction_LD3.gh (54.9 KB)
Hello Joseph thanks for you’re time , but with this solution still outputs vertical and diagonals together
Hello inno , thanks for this solution, i have tested all the batch of curves i have and works well with sorting the curve based on direction .It has not only given me 3 categories but all more deeper for example it gives diagonal left and right when i use the explode tree component. Thanks for you’re time !
Hello Laurent thanks for this solution , its works well but only has problem with picking the vertical curves .