VEX get the vertex number

   4936   2   2
User Avatar
Member
52 posts
Joined: June 2016
Offline
Hi,
I simply want to find the vertex number of a point inside a given primitive in VEX



For example :
I want to find the vertex number of point 45 in primitive 41 (which is 0)
I want to find the vertex number of point 45 in primitive 31 (which is 2)
I want to find the vertex number of point 55 in primitive 41 (which is 3)


I tried int pointvertex(<geometry>geometry, int point_num) function,
int primvertex(<geometry>geometry, int primnum, int vertex)
I also tried primvertices or pointvertices

But they never gives me the good number, maybe because this is linear vertex

Any help would be appreciated

Thanks !

Attachments:
Capture.JPG (37.9 KB)

User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
You need vertexprimindex [www.sidefx.com] to convert from linear (“global”) vertex ID to “local” (within the given primitive).

Marc Albrecht
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
52 posts
Joined: June 2016
Offline
Ahh okay, i've missed this one !

so I did something, a little bit tricky, I don't know if there's a simpler way but I found what I want.

int point = 55;
int primitive = 41;

int vtxList[] = pointvertices(0, point);
i[]@vtxList = vtxList;

int primList[];
foreach(int vtx; vtxList)
{
    int prim = vertexprim(0, vtx);
    append(primList, prim);
    if(prim == primitive)
    {
        int vtxNum = vertexprimindex(0, vtx);
        setpointattrib(0, "vtxNum", point, vtxNum, "set");
    }
}
i[]@primList = primList;

Thanks !
  • Quick Links