坐标变换

更全面的坐标变换请使用Matrix4矩阵实现,这里的坐标变换是为了方便2D下的操作,比矩阵高效(在某些情况下)。

rotate

var newP=$$.rotate(cx, cy, deg, x, y);

点(x,y)围绕中心(cx,cy)旋转deg度,返回新的坐标。

move

var newP=$$.move(ax, ay, d, x, y);

点(x,y)沿着向量(ax,ay)方向移动距离d,返回新的坐标。

scale

var newP=$$.scale(cx, cy, times, x, y);

点(x,y)围绕中心(cx,cy)缩放times倍,返回新的坐标。