本文整理汇总了C++中Point::Pol2Cart方法的典型用法代码示例。如果您正苦于以下问题:C++ Point::Pol2Cart方法的具体用法?C++ Point::Pol2Cart怎么用?C++ Point::Pol2Cart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::Pol2Cart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Problem_1_C
void Problem_1_C()
{
Image imTransformer, imTransformerWarped;
int iRows = 500, iCols = 500;
string strNames[2] = {"transformmer.raw","transformer_warped.raw"};
InitImage(&imTransformer,strNames[0],iRows,iCols,3);
InitImage(&imTransformerWarped,strNames[1],iRows,iCols,3);
imTransformer.ReadImageData();
imTransformerWarped.FillColor(0);
//Quadrant 1
//Forward Method
//for(int i = 0;i<500;i++)
//{
// for(int j = 0;j<500;j++)
// {
// Point ptP((double)i/499,(double)j/499);
// ptP.Cart2Pol(0.499,0.499);
//
// double dOpRad = 0.499;
// double dIpRad = ptP.FindDistanceFromSq();
// double dScaleFactor = 0.499/dIpRad;
//
// Point ptPOut;
// ptPOut.iRad = dScaleFactor*ptP.iRad;
// ptPOut.iTheta = ptP.iTheta;
//
// ptPOut.Pol2Cart(0.499,0.499);
//
// if(ptPOut.iRad > 0.500)
// continue;
// //cout<<"\ni: "<<i<<" j: "<<j;
// imTransformerWarped.SetPixel(ptPOut.iX*499,ptPOut.iY*499,*imTransformer.GetPixel(i,j));
// }
//}
//Reverse Method
for(double i = 0;i<0.5;i +=0.002)
{
for(double d = 0;d<360.00;d += 0.1)
{
Point ptP;
ptP.iRad = i;
ptP.iTheta = d;
ptP.Pol2Cart(0.5,0.5);
double dOpRad = 0.5;
double dIpRad = ptP.FindDistanceFromSq();
double dScaleFactor = dOpRad/dIpRad;
Point ptPIP;
ptPIP.iRad = (1/dScaleFactor)*i;
ptPIP.iTheta = ptP.iTheta;
ptPIP.Pol2Cart(0.5,0.5);
imTransformerWarped.SetPixel(ptP.iX*499,ptP.iY*499,*imTransformer.GetPixel(ptPIP.iX*499,ptPIP.iY*499));
}
}
imTransformerWarped.WriteImageData();
cout<<"\nPress 'C' to continue";
getch();
}