Jump to content

3d subdivide Packed?(SOLVED)


Librarian

Recommended Posts

@Atom
what if we have BBox how to use those in DOP like Transformer effect or somthing.
Best approach??
@vinyvince post "your" files ...share with peoples ...:P

oh I found on Cgworld Japan new file under tutorial yesssssss
 

int dotranslate = chi("dotranslate");
int dotrotate = chi("dotrotate");
int doscale = chi("doscale");
int uniformscale = chi("uniformscale");

vector min0,max0,min1,max1;
float pb0[] = primintrinsic(0,'packedbounds',@primnum);
float pb1[] = primintrinsic(1,'packedbounds',@primnum);

for(int i;i<3;i++){
    min0[i]= pb0[i*2];
    max0[i]= pb0[i*2+1];
    min1[i]=pb1[i*2];
    max1[i]=pb1[i*2+1];
    }

vector size0 = max0-min0;
vector center0 = (max0+min0)/2;
vector size1 = max1 -min1;
vector center1 = (max1+min1)/2;

matrix T = 1 ;
matrix R = 1 ;
matrix S = 1 ;

if ( dotranslate){
    vector t = center1 -center0;
    translate(T,t);
    }

if (dotrotate){
    float size0_array[]= set(size0);
    float size1_array[]= set(size1);
    
    int size0_argsort[]= argsort(size0_array);
    int size1_argsort[]= argsort(size1_array);
    vector newsize = size0;
    
    vector mr[];
    for(int i;i<3; i++){
        vector axis;
        axis[size1_argsort[i] ]=1;
        mr[size0_argsort[i] ]=axis;
        
        newsize[size0_argsort[i]]= size0[size0_argsort[i]];
        }

        
    size0 = newsize;
    //mr[2]= cross(mr[0],mr[1]);
    R = set(mr);

}
if(doscale){
    //@P = fit(@P,min0,max0,min1,max1);
    vector s = size1/size0;
    if (uniformscale){
        s = min(s);
        }
        scale(S,s);
}

vector p = center0;matrix X = 1;translate(X,p);

matrix xform = invert(X)*R*S*T*X;

matrix fulltransform = primintrinsic(1,'packedfulltransform',@primnum);
setpackedtransform(0,@primnum,X*xform*fulltransform);


 

camAsia5.gif
can be useful for 3d Print

Pack.hiplc

Edited by Librarian
Link to comment
Share on other sites

  • Librarian changed the title to 3d subdivide Packed?(SOLVED)

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...