1. <legend id='46eOQ'><style id='46eOQ'><dir id='46eOQ'><q id='46eOQ'></q></dir></style></legend>
    2. <tfoot id='46eOQ'></tfoot>

      <small id='46eOQ'></small><noframes id='46eOQ'>

        <bdo id='46eOQ'></bdo><ul id='46eOQ'></ul>
    3. <i id='46eOQ'><tr id='46eOQ'><dt id='46eOQ'><q id='46eOQ'><span id='46eOQ'><b id='46eOQ'><form id='46eOQ'><ins id='46eOQ'></ins><ul id='46eOQ'></ul><sub id='46eOQ'></sub></form><legend id='46eOQ'></legend><bdo id='46eOQ'><pre id='46eOQ'><center id='46eOQ'></center></pre></bdo></b><th id='46eOQ'></th></span></q></dt></tr></i><div id='46eOQ'><tfoot id='46eOQ'></tfoot><dl id='46eOQ'><fieldset id='46eOQ'></fieldset></dl></div>

      1. 如何按自己的中心旋转所有对象,然后将它们转

        时间:2023-09-17

          <tbody id='ODhEQ'></tbody>
        • <bdo id='ODhEQ'></bdo><ul id='ODhEQ'></ul>

            1. <i id='ODhEQ'><tr id='ODhEQ'><dt id='ODhEQ'><q id='ODhEQ'><span id='ODhEQ'><b id='ODhEQ'><form id='ODhEQ'><ins id='ODhEQ'></ins><ul id='ODhEQ'></ul><sub id='ODhEQ'></sub></form><legend id='ODhEQ'></legend><bdo id='ODhEQ'><pre id='ODhEQ'><center id='ODhEQ'></center></pre></bdo></b><th id='ODhEQ'></th></span></q></dt></tr></i><div id='ODhEQ'><tfoot id='ODhEQ'></tfoot><dl id='ODhEQ'><fieldset id='ODhEQ'></fieldset></dl></div>
                <tfoot id='ODhEQ'></tfoot><legend id='ODhEQ'><style id='ODhEQ'><dir id='ODhEQ'><q id='ODhEQ'></q></dir></style></legend>
              1. <small id='ODhEQ'></small><noframes id='ODhEQ'>

                  本文介绍了如何按自己的中心旋转所有对象,然后将它们转换到实际位置(它不起作用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  有什么方法可以让所有不与原点中心(vector3(0.0f,0.0f,0.0f))对齐的物体绕自己的中心轴旋转?

                  What is the way to make all the objects that are not aligned with the origin center (vector3(0.0f,0.0f,0.0f)) , rotate about its own central axis?

                  伪代码问题:

                  vector3 vector3 objectCenter = (10,5,0); // current object center
                  vector3 vector3 objectPosition = (40,5,0); // Place to translate the object
                  vector3 objectRotation; = 45.0f;
                  
                      matrix.loadIdentity ();
                      matrix.translate (objectCenter);
                  
                      //apply transformations
                      matrix.rotateX (objectRotation);
                  
                      matrix.translate (-objectCenter);
                  
                      //itś work correctly until here
                      //when i try to translate the object to the real position, the rotation is incorrect.
                  
                      matrix.translate (objectPosition);
                  

                  我使用 C++、glm(矩阵管理)和 OpenGL.

                  I use C++, glm (to matrix manage) and OpenGL.

                  推荐答案

                  如果您想将对象局部旋转到其自己的坐标系,请执行以下操作:

                  if you want to rotate object locally to its own coordinate system then do this:

                  M=inverse(inverse(M)*rotation_matrix);
                  

                  • M 是你的对象变换矩阵
                  • rotation_matrix 是任意旋转 (glRotate())
                  • inverse 是计算逆矩阵的函数,您可以使用我的 逆矩阵计算 或这个 在 C++ 中围绕 LCS x (lrotx) 实现的旋转(在答案的底部)
                    • M is your object transform matrix
                    • rotation_matrix is any rotation (glRotate())
                    • inverse is function that computes the inverse matrix you can use mine inverse matrix computation or this rotation around LCS x (lrotx) implementation in C++ (at the bottom of the answer)
                    • [edit1]更多关于M和它代表的坐标系的对象之间的关系

                      看这里:变换矩阵解剖

                      M 原点通常是物体的中心(或旋转运动的中心点).M 的轴通常与对象对齐,例如在飞机中,X 轴通常是飞行方向.我比较习惯:

                      M origin is usually the middle of object (or point which is center of rotation movements). Axises of M are usually aligned with object for example in airplanes the X axis is usually the fly direction. I am more used to:

                      • +z 轴作为正向运动
                      • +x 为右,-x 为左
                      • +y 向上,-y 向下
                      • +z axis as forward direction movement
                      • +x as right, -x as left
                      • +y as up and -y as down

                      pith,yaw,roll 然后是围绕 x,y,z

                      这篇关于如何按自己的中心旋转所有对象,然后将它们转换到实际位置(它不起作用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:OpenGL 读写相同的纹理 下一篇:如何知道 CMakeLists 的库变量名称?

                  相关文章

                  最新文章

                  1. <legend id='36bns'><style id='36bns'><dir id='36bns'><q id='36bns'></q></dir></style></legend>

                      <bdo id='36bns'></bdo><ul id='36bns'></ul>

                  2. <tfoot id='36bns'></tfoot>
                    <i id='36bns'><tr id='36bns'><dt id='36bns'><q id='36bns'><span id='36bns'><b id='36bns'><form id='36bns'><ins id='36bns'></ins><ul id='36bns'></ul><sub id='36bns'></sub></form><legend id='36bns'></legend><bdo id='36bns'><pre id='36bns'><center id='36bns'></center></pre></bdo></b><th id='36bns'></th></span></q></dt></tr></i><div id='36bns'><tfoot id='36bns'></tfoot><dl id='36bns'><fieldset id='36bns'></fieldset></dl></div>

                    <small id='36bns'></small><noframes id='36bns'>