From: Anthony Geay Date: Wed, 29 Apr 2015 13:24:39 +0000 (+0200) Subject: OK for atan2. Micro correction of ref test. Valgrinification of MEDCouplingBasicsTest... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b921bc415555212f1b8a430919eba2ce39f91e5b;p=tools%2Fmedcoupling.git OK for atan2. Micro correction of ref test. Valgrinification of MEDCouplingBasicsTest.py remaining :-) --- diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index 99fd1d492..491ff1578 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -529,32 +529,9 @@ double EdgeArcCircle::GetAbsoluteAngle(const double *vect, double& normVect) */ double EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(double ux, double uy) { - //When arc is lower than 0.707 Using Asin - if(fabs(ux)<0.707) - { - double ret=SafeAcos(ux); - if(uy>0.) - return ret; - ret=-ret; - return ret; - } - else - { - double ret=SafeAsin(uy); - if(ux>0.) - return ret; - if(ret>0.) - return M_PI-ret; - else - return -M_PI-ret; - } + return atan2(uy, ux); } -//double EdgeArcCircle::GetAbsoluteAngleOfNormalizedVect(double ux, double uy) -//{ -// return atan2(uy, ux); -//} - void EdgeArcCircle::GetArcOfCirclePassingThru(const double *start, const double *middle, const double *end, double *center, double& radius, double& angleInRad, double& angleInRad0) { @@ -667,9 +644,9 @@ void EdgeArcCircle::getMiddleOfPoints(const double *p1, const double *p2, double // double myDelta1(angle1-_angle0),myDelta2(angle2-_angle0); if(_angle>0.) - { myDelta1=myDelta1>=0.?myDelta1:myDelta1+2.*M_PI; myDelta2=myDelta2>=0.?myDelta2:myDelta2+2.*M_PI; } + { myDelta1=myDelta1>-QUADRATIC_PLANAR::_precision?myDelta1:myDelta1+2.*M_PI; myDelta2=myDelta2>-QUADRATIC_PLANAR::_precision?myDelta2:myDelta2+2.*M_PI; } else - { myDelta1=myDelta1<=0.?myDelta1:myDelta1-2.*M_PI; myDelta2=myDelta2<=0.?myDelta2:myDelta2-2.*M_PI; } + { myDelta1=myDelta1decrRef(); end->decrRef(); } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index b0cbd8274..889bf2c7e 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -14622,14 +14622,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): coo2=DataArrayDouble([(-5,0),(-1,0),(7.,6.),(7,0),(1,6),(1,0),(-3,0),(8.2426406871192839,3),(5,0),(3,0), (2,0),(4,0),(6,0),(7.9196888946291288,1.3764116995614091),(7.9196888946291288,4.6235883004385911),(4,7.2426406871192848),(-2,3),(-4,0),(-2,0),(0,0)]) m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coo2) ; m.allocateCells() m.insertNextCell(NORM_QPOLYG,[5,9,8,3,7,2,4,0,6,1,10,11,12,13,14,15,16,17,18,19]) - mm = m.deepCpy() - mm.tessellate2D(0.1) - mm.writeVTK("/tmp/colin_1_a.vtu") refPtr=m.getCoords().getHiddenCppPointer() self.assertTrue(m.colinearize2D(1e-12).isEqual(DataArrayInt([0]))) - mm = m.deepCpy() - mm.tessellate2D(0.1) - mm.writeVTK("/tmp/colin_1_b.vtu") self.assertNotEqual(refPtr,m.getCoords().getHiddenCppPointer())#not same coordinates here self.assertTrue(coo2.isEqual(m.getCoords()[:20],1e-12)) self.assertTrue(m.getCoords()[20:].isEqual(DataArrayDouble([(1.,0.),(7.,6.)]),1e-12))