]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Last checks of the new option for 3D surf
authorgeay <anthony.geay@cea.fr>
Mon, 24 Feb 2014 11:05:30 +0000 (12:05 +0100)
committergeay <anthony.geay@cea.fr>
Mon, 24 Feb 2014 11:05:30 +0000 (12:05 +0100)
src/INTERP_KERNEL/Geometric2DIntersector.txx
src/INTERP_KERNEL/PlanarIntersector.txx
src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx

index 6b1e0f1039dadbb4f2f3c3f531c5125346267a9d..e153067a3efccfc17e77e0d3c0a3dad7dd581f67 100644 (file)
@@ -63,7 +63,7 @@ namespace INTERP_KERNEL
     QuadraticPolygon *p2=buildPolygonFrom(CoordsS,tS);
     double ret=p1->intersectWithAbs(*p2);
     delete p1; delete p2;
-    return ret;
+    return orientation*ret;
   }
 
   INTERSECTOR_TEMPLATE
@@ -81,7 +81,7 @@ namespace INTERP_KERNEL
     QuadraticPolygon *p2=buildPolygonOfOneEdgeFrom(CoordsS,tS);
     double ret=p1->intersectWithAbs1D(*p2, isColinear);
     delete p1; delete p2;
-    return ret;
+    return orientation*ret;
   }
 
   INTERSECTOR_TEMPLATE
index 6f0c5aa5d0f7d8363446a06d42154dfe066f098d..11b959dec1dd19f0a869d1bfbd2cb1b648fc0daf 100644 (file)
@@ -32,7 +32,7 @@ namespace INTERP_KERNEL
   template<class MyMeshType, class MyMatrix>
   PlanarIntersector<MyMeshType,MyMatrix>::PlanarIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel):
     _meshT(meshT),_meshS(meshS),
-    _dim_caracteristic(dimCaracteristic),_max_distance_3Dsurf_intersect(md3DSurf),_precision(precision),_median_plane(medianPlane),
+    _dim_caracteristic(dimCaracteristic),_max_distance_3Dsurf_intersect(md3DSurf),_min_dot_btw_3Dsurf_intersect(minDot3DSurf),_precision(precision),_median_plane(medianPlane),
     _do_rotate(doRotate),_orientation(orientation),_print_level(printLevel)
   {
     _connectT=meshT.getConnectivityPtr();
@@ -344,7 +344,13 @@ namespace INTERP_KERNEL
     if(i_A2<nb_NodesA && i_B2<nb_NodesB)
       {
         //Build the normal of the median plane
-        same_orientation=dotprod<SPACEDIM>(normal_A,normal_B)>=0;
+
+        double dotProd(dotprod<SPACEDIM>(normal_A,normal_B)/(normA*normB));
+
+        if(fabs(dotProd)<minDot3DSurf)
+          return 0;
+
+        same_orientation=(dotProd>=0);
         
         if(!same_orientation)
           for(int idim =0; idim< SPACEDIM; idim++)
index cce28e644b8af8abb4a536c891162506d1fcd980..5d66b9d19344267e12c6020698d341fddf64dd4e 100644 (file)
@@ -100,6 +100,26 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test2()
   std::copy(coo2,coo2+9,tmp1);
   ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::Projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,-1.,0.5,true);
   CPPUNIT_ASSERT_EQUAL(0,ret);
+  // again max 3D distance is 1e-5 > 1e-6 so 1 is expected
+  std::copy(coo,coo+9,tmp0);
+  std::copy(coo2,coo2+9,tmp1);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,-1.,0.5,true);
+  CPPUNIT_ASSERT_EQUAL(1,ret);
+  // again max 3D distance is 1e-5 > 1e-6 but minDot set to 0.8. 0 expected. because the angle is pi/4 so cos(pi/3) > 0.8
+  std::copy(coo,coo+9,tmp0);
+  std::copy(coo2,coo2+9,tmp1);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.8/* <- */,0.5,true);
+  CPPUNIT_ASSERT_EQUAL(0,ret);
+  // again max 3D distance is 1e-5 > 1e-6 but minDot set to 0.7. 1 expected. because the angle is pi/4 so cos(pi/3) < 0.49
+  std::copy(coo,coo+9,tmp0);
+  std::copy(coo2,coo2+9,tmp1);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.49/* <- */,0.5,true);
+  CPPUNIT_ASSERT_EQUAL(1,ret);
+  // again max 3D distance is 1e-5 > 1e-6 but minDot set to 0.7. 0 expected. because the angle is pi/4 so cos(pi/3) > 0.51
+  std::copy(coo,coo+9,tmp0);
+  std::copy(coo2,coo2+9,tmp1);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.51/* <- */,0.5,true);
+  CPPUNIT_ASSERT_EQUAL(0,ret);
   //
   delete [] tmp0;
   delete [] tmp1;