Ali Al-Tobi

altobi

About Me

専門知識
Technical Director
業界:
Film/TV

Connect

LOCATION
United Kingdom
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

Vulkan Viewport and macOS silicon ? 2024年7月11日14:47

Yea I'm very disappointed in the lack of support for Apple Silicon..

find primitive neighbours? 2019年12月17日6:58

I wrote a solution for this over in this thread:

https://www.sidefx.com/forum/topic/70966/?page=1#post-301099 [www.sidefx.com]

VEX primitive neighbours function 2019年12月11日10:40

Hi wizards,

Here's a VEX function to get primitive neighbours either by shared points or by shared edges. Use the type function input for the two different methods (0 points, 1 edges);

function int []primneighbours (int geometry; int prim; int type)
{

    int primPts[] = primpoints(geometry, prim);
    int nearPrims[];
    int sharedPrims[];
    
    // Find primitives attached to the input primitive-points
    foreach(int num; int pt; primPts)
    {
        int ptPrims[] = pointprims(geometry, pt);
        
        foreach(int num1; int ptPrim; ptPrims)
        {
            int used = 0;
            
            foreach(int num2; int usedPrim; nearPrims)
            {
                if(usedPrim == ptPrim)
                {
                    used = 1;
                }
            }
            
            if(used == 0)
            {
                append(nearPrims, ptPrim);
            }
        }
    }
    
    // Find primitives sharing the two or more points with the input primitive
    foreach(int num3; int nearPrim; nearPrims)
    {
        int tempPrimPts[] = primpoints(geometry, nearPrim);
        int similarPts = 0;
        
        foreach(int num4; int tempPrimPt; tempPrimPts)
        {
            foreach(int num5; int primPt; primPts)
            {
                if(tempPrimPt == primPt)
                {
                    similarPts++;
                }
            }
        }
        
        if(similarPts > 1)
        {
            append(sharedPrims, nearPrim);
        }
    }
    
    // Return based on input type
    if(type > 0)
    {
        return sharedPrims;
    }
    else
    {
        return nearPrims;
    }
}


Use the function like this (outside the function itself):
int neigh[] = primneighbours(0, @primnum, 1);


Grouping neighbours example:

int neigh[] = primneighbours(0, 70, 1);
foreach(int num; int prim; neigh)
{
    setprimgroup(0, "nearPrims", prim, 1, "set");
}


Enjoy!