I have an array which contains 3d modeling information x, y, z coordinates for a structure rotated and placed in the desired stance. I also have a new array which has similar structure without the rotation or placement. The new structures coordinates begin at [0 0 0].
It is easy to get the first portion of the structure into the right place by adding the first element of the properly rotated array to the unstructured array. My problem now is the rotation. How do I rotate the new element so that it matches the angle in x, y and z of the properly rotated array?
Thank you
I have an array which contains 3d modeling information x, y, z coordinates for
Share
If you can find three representative vectors up, front and right from the data then the rotation matrix would be:
where O = [ox oy oz] is the origin
This is feasible if you know enough of the geometry of rotated structure.
Why it works is seen from the interpretation of identity matrix and rotation matrix:
In the reference coordinate system
Conversely, if you know that your geometry contains a cube (perhaps even scaled…)
Then knowing which point in the array of rotated vertices corresponds to points
o, F, R, U, and in the case of cube it’s largely a matter of choice…
Front vector = (F-o)/|F-o|, Right = (R-o)/|R-o|, Up = (U-o)/|U-o|