Optimal 3D model rotation for 2D projection

I am looking for a way to determine the optimal X / Y / Z rotation of a set of vertices for rendering (using X / Y coordinates, ignoring Z) on a two-dimensional canvas.

I had several ideas, one of which was pure brute force, including performing a three-dimensional cycle in the range from 0..359 (either in increments of 1, or depending on the results / speed requirements) on a set of vertices, measuring the difference between the minimum / maximum on the X / Y axis, maintaining the highest pairs of results / rotation and using the most efficient pair.

The second idea would be to determine the two points with the greatest distance between them at the Euclidean distance, calculate the angle needed to rotate the “path” between these two points, to lie along the X axis (again, we ignore the Z axis, so the depth as a result does not matter), and then repeated several times. The problem that I see in this is the first repetition, we can redefine our previous rotation with a new rotation and that the initial / subsequent rotation may not necessarily lead to the use of the largest two-dimensional region. The second problem is that if we use one iteration, the same problem arises - the two points farthest from each other may not have other poitns aligned along the same "path", and therefore we, probably,we will not get the optimal rotation for a 2D project.

Using the second idea, perhaps using the first three iterations, preserving the required rotation angle, and averaging over 3 will return a more accurate result, since it takes into account not only one rotation, but also the top 3 'pairs.

Please break these ideas apart, give an idea of ​​yourself. I am interested to know what solutions you have, or algorithms unknown to me that you can quote.

+3
source share
2 answers

I would calculate the principal axes of inertia and take the axis vector vwith the highest corresponding moment. Then I would rotate the vertices to align vwith the z axis. Let me know if you would like more information on how to do this.

, , .. "".

, , , . :

  • , , x-y.

  • , z.

EDIT: , .

. , . . , (0,0,0).

. 3x3, , . , .

. -, , . , , , ; . , , , , (, Eigen SelfAdjointEigenSolver.) , 3x3 .

. . , ; z.

. - 1. , , , , , .

, , . , z, , , ( ) .

+3

.

http://203.208.166.84/masudhasan/cgta_silhouette.pdf

" , , . , , , / ."

. , , .

- : , , , , .

. , , (aka ) .

0

Source: https://habr.com/ru/post/1748301/


All Articles