Hello for everyone,
I am trying to understand the logic of minimum bounding box definition so I can implement it in python script node. The reason is very simple - I am planning to test my gh definitons on Shapediver, which does support python script + Grasshopper. I am trying to develop an automated upper limb 3D scan re-alignment tool and as far as I am aware there is no possibility to (re) execute Galapagos in Shapediver.
I have a well-working definition in Grasshopper + Galapagos (attached) and I do have a sense that it is checking all possible options (optimisation algorithm) and seeks out for the best combination which generates minimum volume.
I did try to convert VBS to Python syntax of the code kindly provided by Mitch Heynick (I have a feeling that [Helvetosaur] is the same person here) but I am getting errors there as well (also attached here). I don’t have strong programming skills, all I do is I use this/grasshopper forums and try to “read” and “rewrite = understand” others scripts.
As I understand this is an iterative process (for loop) to rotate initial WorldXY plane, which defines the orientation of 8 points which defines boundaries of a object. So I have to rotate WorldXY plane around X [1,0,0] AND Y[0,1,0] AND Z[0,0,1] axes 360 times each and for every combination create generate “boundaries” for every combinations and check if its volume is still smaller than initial volume? So this is 360360360 combinations? So should I write all values (volumes) generated in for loop into a list and find a minimum value of that list? I am loosing track here at some point. Don’t really understand how to move from this point.
I don’t need a very precise and accurate method to find a minimum oriented bounding box. I would be very thankful if anyone could advise me how to implement this or give some hints about the most effective way to do it. It can be any example, even not related with this topic. Maybe there is a literature which practically explores similar optimization issues? I appreciate for your time and help QuickminimumBB VBS to Python Script by Mitch.gh (5.3 KB)
min_oriented_bb_ilja.gh (39.8 KB)