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

    • <bdo id='q701b'></bdo><ul id='q701b'></ul>

  • <legend id='q701b'><style id='q701b'><dir id='q701b'><q id='q701b'></q></dir></style></legend>

        <tfoot id='q701b'></tfoot>

        <small id='q701b'></small><noframes id='q701b'>

        二维欧几里得矢量旋转

        时间:2023-10-07
              <tbody id='VCqbu'></tbody>

              <small id='VCqbu'></small><noframes id='VCqbu'>

                <bdo id='VCqbu'></bdo><ul id='VCqbu'></ul>
                <i id='VCqbu'><tr id='VCqbu'><dt id='VCqbu'><q id='VCqbu'><span id='VCqbu'><b id='VCqbu'><form id='VCqbu'><ins id='VCqbu'></ins><ul id='VCqbu'></ul><sub id='VCqbu'></sub></form><legend id='VCqbu'></legend><bdo id='VCqbu'><pre id='VCqbu'><center id='VCqbu'></center></pre></bdo></b><th id='VCqbu'></th></span></q></dt></tr></i><div id='VCqbu'><tfoot id='VCqbu'></tfoot><dl id='VCqbu'><fieldset id='VCqbu'></fieldset></dl></div>
              • <legend id='VCqbu'><style id='VCqbu'><dir id='VCqbu'><q id='VCqbu'></q></dir></style></legend><tfoot id='VCqbu'></tfoot>

                • 本文介绍了二维欧几里得矢量旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个位于坐标 (0, 1) 的欧几里得向量 a.我想将 a 绕原点旋转 90 度(顺时针):(0, 0).

                  I have a euclidean vector a sitting at the coordinates (0, 1). I want to rotate a by 90 degrees (clockwise) around the origin: (0, 0).

                  如果我对这应该如何工作有正确的理解,旋转后的结果 (x, y) 坐标应该是 (1, 0).如果我将它旋转 45 度(仍然是顺时针),我会期望得到的坐标为 (0.707, 0.707).

                  If I have a proper understanding of how this should work, the resultant (x, y) coordinates after the rotation should be (1, 0). If I were to rotate it by 45 degrees (still clockwise) instead, I would have expected the resultant coordinates to be (0.707, 0.707).

                  theta = deg2rad(angle);
                  
                  cs = cos(theta);
                  sn = sin(theta);
                  
                  x = x * cs - y * sn;
                  y = x * sn + y * cs;
                  

                  使用上述代码,angle 值为 90.0 度,结果坐标为:(-1, 1).我他妈的很困惑.以下链接中的示例肯定代表上述相同的公式吗?

                  Using the above code, with an angle value of 90.0 degrees, the resultant coordinates are: (-1, 1). And I am so damn confused. The examples seen in the following links represent the same formula shown above surely?

                  我做错了什么?还是我误解了向量是如何旋转的?

                  What have I done wrong? Or have I misunderstood how a vector is to be rotated?

                  推荐答案

                  你应该从函数中移除变量:

                  you should remove the vars from the function:

                  x = x * cs - y * sn; // now x is something different than original vector x
                  y = x * sn + y * cs;
                  

                  创建新坐标变为,避免在到达第二行之前计算x:

                  create new coordinates becomes, to avoid calculation of x before it reaches the second line:

                  px = x * cs - y * sn; 
                  py = x * sn + y * cs;
                  

                  这篇关于二维欧几里得矢量旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:首次编译错误时自动停止 Visual C++ 2008 构建? 下一篇:对于先前分配的向量,为什么 push_back 比 operato

                  相关文章

                  最新文章

                • <small id='FIDFg'></small><noframes id='FIDFg'>

                  <legend id='FIDFg'><style id='FIDFg'><dir id='FIDFg'><q id='FIDFg'></q></dir></style></legend>

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

                  1. <tfoot id='FIDFg'></tfoot>

                      <bdo id='FIDFg'></bdo><ul id='FIDFg'></ul>