Jump to content

Organic triangle grid


Recommended Posts

Hi there,

 

I'm researching organic deformation on geometric grids and could accomplish some interesting deformation on a quad grid as the img below. Newby stuff

image.jpeg.f982804046e49e89e9b145c37521ebf7.jpeg

 

However, I'm trying to find a way to create the exact deformation on a triangle grid or a remeshed grid. Would someone have an idea about how I can approach this? Any info on how to start is appreciated. Cheers

Link to comment
Share on other sites

@Rival Consoles surface deform SOP , vellum , New Linear Solver , POP to deform only P................................................
 

i[]@pCaptPts = pcfind(1,"P",@P,1e15,8);
float r = 1.1 *distance(point(1,"P",@pCaptPts[-1]),@P);

vector delta;
float totalweight_cpt;
matrix3 totalxform_cpt;

foreach(int cpt;@pCaptPts){
    vector oldcenter = point(1,"P",cpt);//Rest_POint_latice
    vector newcenter= point(2,"P",cpt);//deformed_point_latice
    
    matrix3 xform_cpt = 1;
    int n[] = neighbours(1,cpt);
    //int n[] = neighbours(2,cpt);
    
    matrix3 totalxform = 0;
    float totalweight = 0;
        if (len(n)>1){
        vector lastdp,lastrestdp;
        for (int i;i<len(n);i++){
        
        if(i==0){
        
        lastdp = point(1,"P",n[-1])-oldcenter;
        lastrestdp = point(2,"P",n[-1])-newcenter;
        
        }
        vector dp = cross(dp,lastdp);
        vector restdp = cross(restdp,lastrestdp);
        
        vector up = cross(dp,lastdp);
        vector restup = cross(restdp,lastrestdp);
        
        float w = sqrt(length(up)*length(restup));
        
        matrix3 restxform = maketransform(normalize(restdp),normalize(restup));
        
        matrix3 xform = maketransform(normalize(dp),normalize(up));
        
        totalxform += w*invert(xform)*restxform;
        totalweight += w;
        
        lastrestdp = restdp;
        lastdp = dp;
        
        }
        
        if(totalweight!=0){
            totalxform/= totalweight;
            if(chi("rigidprijection"))
            totalxform = polardecomp(totalxform);
            xform_cpt = totalxform;
            
        }
 }  
 
float dist = distance(oldcenter,@P);
float weight = pow(1-pow(dist/r,2),2);
vector diff = point(2,"P",cpt)-oldcenter;

vector newp = @P;
newp -= oldcenter;
newp *= xform_cpt;
newp += oldcenter;

newp += diff;
delta += weight*(newp-@P);
totalweight_cpt += weight;
totalxform_cpt += xform_cpt*weight;
}


delta /= totalweight_cpt;

@P += delta;

 

zmijugader.gif

Edited by Librarian
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...