rich_lord Posted April 1, 2016 Share Posted April 1, 2016 I need to find out if an edge is a border edge in VEX. Ive tried reading and researching this for several hours, but am getting nowhere. I have this geo: I know the point numbers, but thats about it. How can I tell the the edge defined by points 19 and 9 is a border edge, whereas the edge defined by the points 19 and 8 are not? Quote Link to comment Share on other sites More sharing options...
mestela Posted April 1, 2016 Share Posted April 1, 2016 As I understand it there's no direct way in vex, but you can use neighbourcount(). Obviously if you have faces with 3/4/5 verts, it'll break. int nc = neighbourcount(0,@ptnum); if (nc<4) { @P.y += 1; } The other way is to use a group to detect unshared edges, but I don't know how well it performs with high polycounts. Waiting now for Anim to show us how to do it cleanly in vex in 3... 2... find_edges.hipnc Quote Link to comment Share on other sites More sharing options...
rich_lord Posted April 1, 2016 Author Share Posted April 1, 2016 (edited) Thoose methods sadly don't work. They fail in the example above as line 19, 8 reads as a border edge. I have to convert edge groups to points when I'm in VEX as far as I can tell, so grouping by border edge is useless in VEX. I've tried to understand half edges. But it just wont go into my brain! I cant tell if its useful for this. What I'm trying to do if it helps, is to look at a point, and get vectors pointing towards any other connected point, but only along border edges. Edited April 1, 2016 by rich_lord Quote Link to comment Share on other sites More sharing options...
anim Posted April 1, 2016 Share Posted April 1, 2016 here is a way with half edges: current code is for Detail Wrangle, but you can use that function anywhere int isBorderEdge(int pt0, pt1) { int hedge = pointhedge(0, pt0, pt1); // try finding hedge if (hedge == -1 ) { hedge = pointhedge(0, pt1, pt0); // try reversed hedge if (hedge == -1 ) return -1; // invalid hedge } return hedge_equivcount(0, hedge) == 1; // 1 if border edge } int pt0 = 9; int pt1 = 19; int isborder = isBorderEdge(pt0, pt1); printf("Edge %d-%d is%s edge\n", pt0, pt1, isborder == 1 ? " a border" : isborder == -1 ? " not an" : " not a border"); 3 Quote Link to comment Share on other sites More sharing options...
rich_lord Posted April 2, 2016 Author Share Posted April 2, 2016 (edited) Amazing - thanks anim. Works great in my point wrangle! Edited April 2, 2016 by rich_lord Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.