Jump to content
Sign in to follow this  
anicg

VEX: find the max of the max of bounding boxes of connected pieces

Recommended Posts

Posted (edited)

For each connected piece, get the bounding box, find the axis with the maximum scale and remember just the number. Say e.g. a box is 18 by 3 by 2, a grid is 4 by 7, a sphere is 15 by 15 by 15 then we need 18, 15, and 7.

Then find the max of these maxs (18 vs 7 vs 15) and assign it to an attribute, such that we end up f@maxattrib = 18.

Edited by anicg

Share this post


Link to post
Share on other sites

Put to point wrangle 


int pts[] = neighbours(0,@ptnum);
float dists[];

foreach(int pt; pts){
    vector pos = point(0,"P",pt);
    vector dir = pos-@P;
    float dist = length(dir);
    append(dists,dist);
    
}
dists = sort(dists);
float d = dists[-1]; //longest 
f@d=d;
setdetailattrib(0,'dist',d,'max');

in first input connect all bounding boxes

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×