From 11c3ed8d1c168dc7cab7bad307db9c6d91c57fb1 Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@c-s.fr> Date: Tue, 20 Mar 2007 08:48:04 +0000 Subject: [PATCH] =?UTF-8?q?Suite=20de=20l'int=C3=A9gration=20de=20la=20DXF?= =?UTF-8?q?=20lib.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/Common/otbArcSpatialObject.txx | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Code/Common/otbArcSpatialObject.txx b/Code/Common/otbArcSpatialObject.txx index 55d232417d..d9c1a5229d 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]); -- GitLab