vex removing adjacent mesh faces

   1877   2   0
User Avatar
Member
9 posts
Joined: Oct. 2018
Offline
Hi, I'm trying to remove every other mesh face so that I get a checkboard/chessboard effect. At the moment, this code below doesn't work on every mesh, only ones where the face numbers for the mesh are in a very particular order. Does anyone know how I can do this simply?

Thanks!

if (@primnum%2==0){
    removeprim(0, @primnum, 1);
}
Edited by devinj898 - Dec. 20, 2019 15:22:10

Attachments:
current.jpg (49.3 KB)

User Avatar
Member
9 posts
Joined: Oct. 2018
Offline
Here's what I'm currenlty trying, but it just deletes every prim and it leaves nothing. I thought that the list of polyneighbors would eventually return nothing and then it would just leave the checkerboard, but I think I don't quite know how to do this sort of operation with vex.

for (int i=0; i<@primnum; i++) {
    int pn[] = polyneighbours(0, i);
    if (len(pn)>1) {
        foreach(int pr; pn){
            removeprim(0,pr,1);
        }
    }
}
User Avatar
Member
504 posts
Joined: July 2005
Online
Hi,

one possible way might be using an integer attribute for each prim and using polyneighbours() to grow a selection from an initial polygon. So the first polygon has value 0, in the next step all its neighbours will have value 1, in the next step all neighbours of these neighbours will have value 2 and so on.

Here is an example.

Attachments:
prim_nei_growth.hipnc (89.1 KB)

  • Quick Links