39. Rotate marker


文章作者: cyclezone
版权声明: 本文为博主「cyclezone」的原创文章,采用 CC BY 4.0 许可协议。转载请附上原文出处链接和本声明 cyclezone !

39. Rotate Marker


 // double x, y    the point before rotate;
 // double dx, dy  the base point rotate around;
 // double angle   roate angle in degree;
 // double xO, yO  the point after rotate;

void RotateMarker(double x, double y, double dx, double dy, double angle, double& xO, double& yO)
{
	double dRad = angle*PI / 180.0;
	double dCos = cos(dRad);
	double dSin = sin(dRad);
	xO = x*dCos - y*dSin + (1 - dCos)*dx + dSin*dy;
	yO = x*dSin + y*dCos + (1 - dCos)*dy - dSin*dx;
}
文章作者: cyclezone
版权声明: 本文为博主「cyclezone」的原创文章,采用 CC BY 4.0 许可协议。转载请附上原文出处链接和本声明 cyclezone !

评论
  目录