I want to rotate a set of points by 90° clockwise, like this:
But I use the code as I show here, and set the angle as 90°, center as (100,100), and I get a result like this:
I check the formula, is the same as my code:
cv::Point2f rotate2d(const cv::Point2f& inPoint, const double& angRad)
{
cv::Point2f outPoint;
//CW rotation
outPoint.x = std::cos(angRad)*inPoint.x - std::sin(angRad)*inPoint.y;
outPoint.y = std::sin(angRad)*inPoint.x + std::cos(angRad)*inPoint.y;
return outPoint;
}
cv::Point2f rotatePoint(const cv::Point2f& inPoint,
const cv::Point2f& center,
const double& angRad)
{
return rotate2d(inPoint - center, angRad) + center;
}