如何从平移旋转中找到新坐标
How to find new coordinates from translation rotation
我有一个坐标,想在旋转后得到一个新的坐标,如下图所示。谁能给我一个简单的公式?
编辑:使用 eol 公式后...
有一个非常小的小姐“6.1232338E-15”。
只需使用旋转矩阵(取自https://en.wikipedia.org/wiki/Rotation_matrix):
float newX = x*Math.cos(angleRad) - y*Math.sin(angleRad);
float newY = x*Math.sin(angleRad) - y*Math.cos(angleRad);
需要注意的是,您需要确保角度以弧度为单位,因此您可能需要执行此转换:
float angleRad = angle*Math.PI/180;
我有一个坐标,想在旋转后得到一个新的坐标,如下图所示。谁能给我一个简单的公式?
编辑:使用 eol 公式后...
有一个非常小的小姐“6.1232338E-15”。
只需使用旋转矩阵(取自https://en.wikipedia.org/wiki/Rotation_matrix):
float newX = x*Math.cos(angleRad) - y*Math.sin(angleRad);
float newY = x*Math.sin(angleRad) - y*Math.cos(angleRad);
需要注意的是,您需要确保角度以弧度为单位,因此您可能需要执行此转换:
float angleRad = angle*Math.PI/180;