I put only a little more effort into trying to interpret rotation angle consistently before realizing that we don’t really need the angle at all, just the minimal bounding box. This simplification, along with checking only ±45 degrees instead of ±90 degrees, might have consequences later such as reversed UV dimensions? Would be helpful for you to post some examples internalized as GH please, rather than R6 .3dm file.
The ‘precision’ slider here has the effect of increasing resolution beyond the default one degree increments. A value of two will be half a degree, three will be 1/3rd degree, ten will be 1/10th degree of precision.
It can be clustered this way:
(12.5 KB) (DEPRECATED! see below)
P.S. OOPS! Had to fix two issues with the cluster:
- Don’t assume ‘World XZ’ as the plane of rotation, use Plane Fit (PlFit) instead.
- Handle multiple ‘G’ inputs by using Shift Paths (PShift) instead of flatten.
Note that this whole idea assumes a “Flat Box”. With a more generalized 3D geometry, it is likely to fail at finding the minimal bounding box.
Later… I found that with just one more change, this cluster now handles 3D objects just as well as flat geometry. Replaced Disc with DeBrep and SubSet:
(17.3 KB) (FAIL)
On second thought, this works only because I’m using a “well formed box” as input. Arbitrary geometry that is more complex will likely fail.