//每个点进行缩放
void CMyDraw::ZoomEx()
{
int _nTypeCount = m_vecUnit.size();
for (int _i = 0; _i < _nTypeCount; _i++)
{
int _nCount = m_vecUnit[_i].vecPoint.size();
for (int _j = 0; _j < _nCount; _j++)
{
Zoomeeexxx(m_vecUnit[_i].vecPoint[_j]);
}
}
}
//缩放
void CMyDraw::Zoomeeexxx(__ADTPt3Doub & ptDest_)
{
ptDest_.x -= m_ptPerZoomPos.x;
ptDest_.y -= m_ptPerZoomPos.y;
ptDest_.x = int(ptDest_.x*m_fScale);
ptDest_.y = int(ptDest_.y*m_fScale);
ptDest_.x += m_ptPerZoomPos.x;
ptDest_.y += m_ptPerZoomPos.y;
}
ptDest_.x = int(ptDest_.x*m_fScale);
你要注意,这里转int是近似计算,比如123.4567,转换出来是123,就差一点点。
你反复缩放,误差就会积累、放大。