]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
OK for atan2. Micro correction of ref test. Valgrinification of MEDCouplingBasicsTest...
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 29 Apr 2015 13:24:39 +0000 (15:24 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 29 Apr 2015 13:24:39 +0000 (15:24 +0200)
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx
src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index 99fd1d492334b6b83b9cbf02253cbbe517eb8ab7..491ff1578b5ea97c3d92591b1e952ea06ea9e01c 100644 (file)
@@ -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=myDelta1<QUADRATIC_PLANAR::_precision?myDelta1:myDelta1-2.*M_PI; myDelta2=myDelta2<QUADRATIC_PLANAR::_precision?myDelta2:myDelta2-2.*M_PI; }
   ////
   mid[0]=_center[0]+_radius*cos(_angle0+(myDelta1+myDelta2)/2.);
   mid[1]=_center[1]+_radius*sin(_angle0+(myDelta1+myDelta2)/2.);
index 92e9a959128643536bd19ba1631ebd29e70fec9b..615969ffbfff9fc3431a25a846dfedfb0ce993ef 100644 (file)
@@ -1204,12 +1204,12 @@ void QuadraticPlanarInterpTest::checkGetMiddleOfPoints()
     EdgeArcCircle e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388);
 
     e.getMiddleOfPoints(p1, p2, mid);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.7996918047064556, mid[0], 1.e-7);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(2.5627359689548808, mid[1], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.4372640310451197, mid[1], 1.e-7);
 
     e.getMiddleOfPoints(p2, p1, mid);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.7996918047064556, mid[0], 1.e-7);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(2.5627359689548808, mid[1], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.4372640310451197, mid[1], 1.e-7);
 
     start->decrRef(); end->decrRef();
   }
index b0cbd8274012590787897a1ceae886211c867930..889bf2c7ec4b84b44f4472e34cb3b7a8e58a8088 100644 (file)
@@ -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))