java如何从平移旋转中找到新坐标 1 年 Questions & Answers 352 我有一个坐标,希望在旋转后得到一个新坐标,如下图所示。谁能给我一个简单的公式 编辑:使用eol公式后 有一个非常小的失误“6.1232338E-15”
# 1 楼答案 只需使用旋转矩阵(取自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;
# 1 楼答案
只需使用旋转矩阵(取自https://en.wikipedia.org/wiki/Rotation_matrix):
需要提及的一点是,您需要确保角度以弧度为单位,因此您可能需要执行此转换: