#include <stddef.h>
using namespace HDK_Sample;
void
{
        "hdk_flatten",
        "Flatten",
        1,
        1,
        NULL));
}
    PRM_Name(
"usedir",  
"Use Direction Vector"),
 
};
};
{
}
    : 
SOP_Node(net, name, op), myGroup(NULL)
{
    
    
    
    
    
    
    
    
    
    
    mySopFlags.setManagesDataIDs(true);
    
    mySopFlags.setNeedGuide1(true);
}
SOP_Flatten::~SOP_Flatten() {}
bool
{
    bool changed;
    return changed;
}
{
    
    
        context, 
        myGroup, 
        alone,   
                 
                 
        true,    
        0,       
        -1,      
        true,    
        false,   
        true,    
                 
        0        
    );
}
{
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    {
        
        
        
        
        
        {
            
                continue;
            {
                if (handle.isValid())
                {
                    positionattribs.append(handle);
                }
            }
            {
                if (handle.isValid())
                {
                }
            }
            {
                if (handle.isValid())
                {
                }
            }
        }
        
        {
            
            if (progress.wasInterrupted())
                break;
            {
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                if (!DIRPOP())
                {
                    switch (ORIENT())
                    {
                        case 0 : 
                            break;
                        case 1 : 
                            break;
                        case 2 : 
                            break;
                    }
                }
                else
                {
                    normal.
assign(NX(now), NY(now), NZ(now));
                }
                
                
                for (
exint i = 0; i < positionattribs.size(); ++i)
 
                {
                    p -= normal * (
dot(normal, p) - 
dist);
                    positionattribs(i).set(ptoff, p);
                }
                
                for (
exint i = 0; i < normalattribs.
size(); ++i)
 
                {
                        n = -normal;
                    else
                        n = normal;
                    normalattribs(i).set(ptoff, n);
                }
                
                
                for (
exint i = 0; i < vectorattribs.
size(); ++i)
 
                {
                    v -= normal * 
dot(normal, v);
                    vectorattribs(i).set(ptoff, v);
                }
            }
        }
    }
    
    
    
    
}
{
    float dist = DIST(now);
    float nx = 0;
    if (!DIRPOP())
    {
        switch (ORIENT())
        {
            case 0 : 
                nx = 0; ny = 0; nz = 1;
                break;
            case 1 : 
                nx = 1; ny = 0; nz = 0;
                break;
            case 2 : 
                nx = 0; ny = 1; nz = 0;
                break;
        }
    }
    else
    {
        nx = NX(now); ny = NY(now); nz = NZ(now);
    }
    float size = SYSsqrt(sx*sx + sy*sy + sz*sz);
 
    float cx = normal.
x() * 
dist;
 
    float cy = normal.
y() * 
dist;
 
    float cz = normal.
z() * 
dist;
 
    myGuide1->meshGrid(divs, divs, size, size);
 
    xform = mat3;
}
const char *
{
    return "Geometry to Flatten";
}