[Closed] Box Reorder Challenge
I met an interesting problem. I had a fun solving it… And I think it might be interesting for someone who want to practice in logic and math
Here is the task:
#1 we have a Box object
by default Width is X, Length is Y axis, and Height is Z
we need to re-orient the box where by order (XYZ, XZY, YXZ, YZX, ZXY, ZYX) is specified dimensions (shortest , medium, longest)
for example XYZ means: X-shortest, Y – medium, Z – longest
of course after re-ordeing object has to keep it’s shape and view position and orientation
Sorry but I can’t understand the challenge.
You talk about “re-orient” and about “re-order”, and only with a box that must keep it’s shape, view and orientation.
I can not imagine what you mean.
I understood him to say… change the X, Y, Z values of the box… then you have to re-orient (rotate the box) such that it appears exactly the same as before your change. So if you select the box you will see it’s local axes changing yet it maintains the same visual appearance.
The XYZ “order” is changing but it is always: [shortest, medium, longest]
My guess would be to use coordinate transformation on the box to the “new” coordinate system. This should keep the look and world position the same.
For example… to go from XYZ to XZY… we observe this is a +90 degree rotation about the X-axis…
so:
[90° X-Rot Matrix][XYZBox.tm][90° X-Rot Matrix]^(-1)
dunno…how about just re-orienting the pivot…ie. you don’t have to worry about re-orienting the box afterwards.
So the box looks exactly the same, nothing has moved…but if you reorient the pivot, effectively the local axis (dims) have changed.
What about the pivot?
It must stay at its relative position after rotations or should it move to its original world position?