Jump to content

border edge query in VEX


Recommended Posts

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:

 

post-7586-0-33760700-1459547048_thumb.jp

 

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?

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by rich_lord
Link to comment
Share on other sites

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");

 

  • Like 3
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...