Hello,
How would you select edges by their direction ?
Playing with normals doesn't give me an interesting result as every point share the same normal angle.
Guillaume
Select edges whether horizontal or vertical
7065 7 2- guillaumeayad
- Member
- 4 posts
- Joined: 4月 2020
- Offline
- animatrix_
- Member
- 4694 posts
- Joined: 2月 2012
- Online
Hi,
You can write something like this in a Point Wrangle:
N is the direction you want to select edges from, and tolerance allows you to include only edges that are parallel to N (0) or perpendicular to N (1), or anything in between.
You can write something like this in a Point Wrangle:
vector n = normalize ( chv("v") ); float tolerance = ch("tolerance"); int pts [ ] = neighbours ( 0, @ptnum ); foreach ( int pt; pts ) { if ( @ptnum < pt ) { vector p = point ( 0, "P", pt ); vector dir = normalize ( @P - p ); if ( abs ( abs ( dot ( dir, n ) ) - 1 ) <= tolerance ) setedgegroup ( 0, "edges", @ptnum, pt, 1 ); } }
N is the direction you want to select edges from, and tolerance allows you to include only edges that are parallel to N (0) or perpendicular to N (1), or anything in between.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- vusta
- Member
- 555 posts
- Joined: 2月 2017
- Offline
i modded the code to this cos i find it easier to understand
coz both dir and n are normalised, their dot product will never ever be greater than 1…so 1 - dot is much easier to digest to me.
i'm just a hobbyist tho so don't take me too seriously.
vector n = normalize ( chv("v") ); float tolerance = ch("tolerance"); int pts [ ] = neighbours ( 0, @ptnum ); foreach ( int pt; pts ) { if ( @ptnum < pt ) { vector p = point ( 0, "P", pt ); vector dir = normalize ( @P - p ); if ( 1 - abs(dot ( dir,n )) <= tolerance ) setedgegroup ( 0, "edges", @ptnum, pt, 1 ); } } }
i'm just a hobbyist tho so don't take me too seriously.
- alteredgene
- Member
- 19 posts
- Joined: 3月 2020
- Offline
vusta
i modded the code to this cos i find it easier to understandcoz both dir and n are normalised, their dot product will never ever be greater than 1...so 1 - dot is much easier to digest to me.vector n = normalize ( chv("v") ); float tolerance = ch("tolerance"); int pts [ ] = neighbours ( 0, @ptnum ); foreach ( int pt; pts ) { if ( @ptnum < pt ) { vector p = point ( 0, "P", pt ); vector dir = normalize ( @P - p ); if ( 1 - abs(dot ( dir,n )) <= tolerance ) setedgegroup ( 0, "edges", @ptnum, pt, 1 ); } } }
i'm just a hobbyist tho so don't take me too seriously.
Hi everyone! found this useful!
there is a missing bracket after " if ( 1 - abs(dot ( dir,n )) <= tolerance )"
thought someone might have trouble running the wrangle.
Thanks!
- Matan_Shilo
- Member
- 6 posts
- Joined: 7月 2018
- Offline
- Robot_and_Robot
- Member
- 30 posts
- Joined: 4月 2015
- Offline
- animatrix_
- Member
- 4694 posts
- Joined: 2月 2012
- Online
Robot_and_RobotMatan_Shilo
hello
I'm having a hard time running the wrangle, can someone attache here the hip file, please?
Thank you very much
Same here. I'm getting a rather odd error though the code seems legit.
"Error: Vex error: Preloaded shader is invalid. "
The code I posted compiles.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- michaelngeb
- Member
- 9 posts
- Joined: 4月 2009
- Offline
Hello all
Three years late but better than never.
A student of mine was asking about selecting edges procedurally to polybevel.
After failing to find a solution with the group SOP, I found animatrix's wrangle solution.
At first, I too had the same weird 'shader error', but after some troubleshooting and clearing the extra brace added by vusta,
I managed to get things to work and added some comments in this example file in my journey to understand the code.
It is not fully procedural but it is a way forward instead of manual selection.
Hope it helps others jumping into this in future as I have done this Dec 2023.
p/s you have to click on the top right button in the point wrangle SOP to create the spare parameters after you paste the code.
Michael Ng
Nanyang Polytechnic
Three years late but better than never.
A student of mine was asking about selecting edges procedurally to polybevel.
After failing to find a solution with the group SOP, I found animatrix's wrangle solution.
At first, I too had the same weird 'shader error', but after some troubleshooting and clearing the extra brace added by vusta,
I managed to get things to work and added some comments in this example file in my journey to understand the code.
It is not fully procedural but it is a way forward instead of manual selection.
Hope it helps others jumping into this in future as I have done this Dec 2023.
p/s you have to click on the top right button in the point wrangle SOP to create the spare parameters after you paste the code.
Michael Ng
Nanyang Polytechnic
Edited by michaelngeb - 2023年12月7日 22:19:41
-
- Quick Links