在围绕中心点旋转三角形时遇到问题,三角形在尝试旋转时会扭曲并超过它的通常尺寸。
这是我与
合作的内容 x1r = ((x1 - s.x) * cos(radians)) - ((s.y - y1) * sin(radians)) + s.x;
y1r = ((s.y - y1) * cos(radians)) + ((x1 - s.x) * sin(radians)) + s.y;
x2r = ((x2 - s.x) * cos(radians)) - ((s.y - y2) * sin(radians)) + s.x;
y2r = ((s.y - y2) * cos(radians)) + ((x2 - s.x) * sin(radians)) + s.y;
x3r = ((x3 - s.x) * cos(radians)) - ((s.y - y3) * sin(radians)) + s.x;
y3r = ((s.y - y3) * cos(radians)) + ((x3 - s.x) * sin(radians)) + s.y;
非常感谢任何指导!
答案 0 :(得分:2)
用于在3个点中旋转的错误公式。 Ref
//x1r = ((x1 - s.x) * cos(radians)) - ((s.y - y1) * sin(radians)) + s.x;
//y1r = ((s.y - y1) * cos(radians)) + ((x1 - s.x) * sin(radians)) + s.y;
x1r = ((x1 - s.x) * cos(radians)) - ((y1 - s.y) * sin(radians)) + s.x;
y1r = ((y1 - s.y) * cos(radians)) + ((x1 - s.x) * sin(radians)) + s.y;