diff --git a/Code/Common/otbArcSpatialObject.txx b/Code/Common/otbArcSpatialObject.txx index 55d232417daf7ef59584eec4e45f778cc5db86a0..d9c1a5229d87734c017e46b4cad0b8b2a9c8c8dd 100644 --- a/Code/Common/otbArcSpatialObject.txx +++ b/Code/Common/otbArcSpatialObject.txx @@ -20,7 +20,7 @@ PURPOSE. See the above copyright notices for more information. #include "otbArcSpatialObject.h" -#define M_PI 4*vcl_atan(1); +#define M_PI 4*vcl_atan(1) namespace otb { @@ -72,7 +72,7 @@ ArcSpatialObject< VDimension > double angle; if(transformedPoint[0]!=0) { - angle=atan(transformedPoint[1]/transformedPoint[0])*180/M_PI; + angle=vcl_atan(transformedPoint[1]/transformedPoint[0])*180/M_PI); } else if(transformedPoint[1]>0) { @@ -153,13 +153,13 @@ ArcSpatialObject< VDimension > if (alpha<=180) { - pntA[0]=m_Radius*cos(m_Angle1*M_PI/180); - pntA[1]=m_Radius*sin(m_Angle1*M_PI/180); - pntB[0]=m_Radius*cos(m_Angle2*M_PI/180); - pntB[1]=m_Radius*sin(m_Angle2*M_PI/180); + pntA[0]=m_Radius*vcl_cos(m_Angle1*M_PI/180); + pntA[1]=m_Radius*vcl_sin(m_Angle1*M_PI/180); + pntB[0]=m_Radius*vcl_cos(m_Angle2*M_PI/180); + pntB[1]=m_Radius*vcl_sin(m_Angle2*M_PI/180); - longueur=sqrt((pntB[0]-pntA[0])*(pntB[0]-pntA[0])+(pntB[1]-pntA[1])*(pntB[1]-pntA[1])); - largeur=m_Radius*(1-cos((alpha/2)*M_PI/180)); + longueur=vcl_sqrt((pntB[0]-pntA[0])*(pntB[0]-pntA[0])+(pntB[1]-pntA[1])*(pntB[1]-pntA[1])); + largeur=m_Radius*(1-vcl_cos((alpha/2)*M_PI/180)); pntC[0]=pntB[0]+largeur*(pntB[1]-pntA[1])/longueur; pntC[1]=pntB[1]-largeur*(pntB[0]-pntA[0])/longueur; pntD[0]=pntA[0]+largeur*(pntB[1]-pntA[1])/longueur; @@ -167,16 +167,16 @@ ArcSpatialObject< VDimension > } else { - pntA[0]=m_Radius*cos(m_Angle1*M_PI/180); - pntA[1]=m_Radius*sin(m_Angle1*M_PI/180); - pntB[0]=m_Radius*cos(m_Angle2*M_PI/180); - pntB[1]=m_Radius*sin(m_Angle2*M_PI/180); - longueur=sqrt((pntB[0]-pntA[0])*(pntB[0]-pntA[0])+(pntB[1]-pntA[1])*(pntB[1]-pntA[1])); - largeur=m_Radius*(1-cos((alpha/2)*M_PI/180)); - pntA[0]=(m_Radius/2)*(cos(m_Angle1*M_PI/180)+cos(m_Angle2*M_PI/180))-(m_Radius*m_Radius/longueur)*(cos(m_Angle1*M_PI/180)-cos(m_Angle2*M_PI/180)); - pntA[1]=(m_Radius/2)*(sin(m_Angle1*M_PI/180)+sin(m_Angle2*M_PI/180))-(m_Radius*m_Radius/longueur)*(sin(m_Angle1*M_PI/180)-sin(m_Angle2*M_PI/180)); - pntB[0]=(m_Radius/2)*(cos(m_Angle1*M_PI/180)+cos(m_Angle2*M_PI/180))+(m_Radius*m_Radius/longueur)*(cos(m_Angle1*M_PI/180)-cos(m_Angle2*M_PI/180)); - pntB[1]=(m_Radius/2)*(sin(m_Angle1*M_PI/180)+sin(m_Angle2*M_PI/180))+(m_Radius*m_Radius/longueur)*(sin(m_Angle1*M_PI/180)-sin(m_Angle2*M_PI/180)); + pntA[0]=m_Radius*vcl_cos(m_Angle1*M_PI/180); + pntA[1]=m_Radius*vcl_sin(m_Angle1*M_PI/180); + pntB[0]=m_Radius*vcl_cos(m_Angle2*M_PI/180); + pntB[1]=m_Radius*vcl_sin(m_Angle2*M_PI/180); + longueur=vcl_sqrt((pntB[0]-pntA[0])*(pntB[0]-pntA[0])+(pntB[1]-pntA[1])*(pntB[1]-pntA[1])); + largeur=m_Radius*(1-vcl_cos((alpha/2)*M_PI/180)); + pntA[0]=(m_Radius/2)*(vcl_cos(m_Angle1*M_PI/180)+vcl_cos(m_Angle2*M_PI/180))-(m_Radius*m_Radius/longueur)*(vcl_cos(m_Angle1*M_PI/180)-vcl_cos(m_Angle2*M_PI/180)); + pntA[1]=(m_Radius/2)*(vcl_sin(m_Angle1*M_PI/180)+vcl_sin(m_Angle2*M_PI/180))-(m_Radius*m_Radius/longueur)*(vcl_sin(m_Angle1*M_PI/180)-vcl_sin(m_Angle2*M_PI/180)); + pntB[0]=(m_Radius/2)*(vcl_cos(m_Angle1*M_PI/180)+vcl_cos(m_Angle2*M_PI/180))+(m_Radius*m_Radius/longueur)*(vcl_cos(m_Angle1*M_PI/180)-vcl_cos(m_Angle2*M_PI/180)); + pntB[1]=(m_Radius/2)*(vcl_sin(m_Angle1*M_PI/180)+vcl_sin(m_Angle2*M_PI/180))+(m_Radius*m_Radius/longueur)*(vcl_sin(m_Angle1*M_PI/180)-vcl_sin(m_Angle2*M_PI/180)); pntC[0]=pntB[0]-(largeur/(2*m_Radius))*(pntB[1]-pntA[1]); pntC[1]=pntB[1]+(largeur/(2*m_Radius))*(pntB[0]-pntA[0]); pntD[0]=pntA[0]-(largeur/(2*m_Radius))*(pntB[1]-pntA[1]);