# What primhedge function does ?

## Recommended Posts

Hello,

I want to ask one quick question. What primhedge function does, according to help file it is returning the number of an arbitrary half-edge that contained in prim.

Thanks

##### Share on other sites

Thanks Fuat

I have already read this link but not able to understand .Can you explain me little if you get this function.

##### Share on other sites

hi Sourabh,
what exactly didnt you understand? what exactly do you want to do?
that maybe helps to understand what you are after.

EDIT: maybe also read about other functions like vertexhedge or hedge_prim, they are very well described and documented.
hope this helps

fuat

Edited by fuat

##### Share on other sites

You can use it to write neighbours() function analog for primitives:

```// Primitive wrangle.

i[]@neighbours;

int prim_edge = primhedge(0, @primnum);
for (int i = 0; i < primvertexcount(0, @primnum); i++)
{
for (int j = 0; j < hedge_equivcount(0, prim_edge); j++)
{
int edge = hedge_nextequiv(0, prim_edge);
int prim = hedge_prim(0, edge);
if (prim != @primnum)
{
append(i[]@neighbours, prim);
}
prim_edge = edge;
}
prim_edge = hedge_next(0, prim_edge);
}```

The code based on the example from @petz.

We don't use half edge functions much, because all kinds of higher-level geometry functions like that are implemented in VEX already. Otherwise they would be everywhere. I prefer to think of them like a building blocks for functions like neighbour, primpoints, pointvertices, etc. Almost never used any of them, and searching through \$HH/vex/ shows a little use too.

Edited by f1480187
• 1

## Create an account

Register a new account