From: jfa Date: Tue, 26 Aug 2008 11:03:00 +0000 (+0000) Subject: Fix cross-platform instability in case trianglesTangencyCritical_Triangulation(). X-Git-Tag: EndIntegAG1302~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c9abbb902647dba207be65d92ce553a1c502a26b;p=tools%2Fmedcoupling.git Fix cross-platform instability in case trianglesTangencyCritical_Triangulation(). --- diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index 366c101c6..af61e9d19 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -211,7 +211,8 @@ namespace INTERP_KERNEL /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */ inline void rajou_sommet_triangl(const double* P_1,const double* P_2,const double* P_3, - const double* P_4,const double* P_5,const double* P_6,std::vector& V, double dim_caracteristic, double precision) + const double* P_4,const double* P_5,const double* P_6, + std::vector& V, double dim_caracteristic, double precision) { double absolute_precision = precision*dim_caracteristic; @@ -234,7 +235,8 @@ namespace INTERP_KERNEL /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/ inline void inters_de_segment(const double * P_1,const double * P_2, - const double * P_3,const double * P_4,std::vector& Vect, + const double * P_3,const double * P_4, + std::vector& Vect, double dim_caracteristic, double precision) { @@ -245,21 +247,20 @@ namespace INTERP_KERNEL double absolute_precision = dim_caracteristic*precision; if(fabs(det)>absolute_precision) { - double k_1=-((P_3[1]-P_4[1])*(P_3[0]-P_1[0])+(P_4[0]-P_3[0])*(P_3[1]-P_1[1]))/det; - - if( k_1>=0 && k_1<=1) + + //if( k_1>=0 && k_1<=1) + if (k_1 >= -absolute_precision && k_1 <= 1+absolute_precision) { double k_2= ((P_1[1]-P_2[1])*(P_1[0]-P_3[0])+(P_2[0]-P_1[0])*(P_1[1]-P_3[1]))/det; - - if( k_2>=0 && k_2<=1) + //if( k_2>=0 && k_2<=1) + if (k_2 >= -absolute_precision && k_2 <= 1+absolute_precision) { double P_0[2]; P_0[0]=P_1[0]+k_1*(P_2[0]-P_1[0]); P_0[1]=P_1[1]+k_1*(P_2[1]-P_1[1]); verif_point_dans_vect(P_0,Vect,absolute_precision); - } } } @@ -528,21 +529,22 @@ namespace INTERP_KERNEL /* que les deux premières coordonnées de chaque point */ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/ template inline void intersec_de_polygone(const double * Coords_A, const double * Coords_B, - int nb_NodesA, int nb_NodesB, - std::vector& inter, double dim_caracteristic, double precision) - { + int nb_NodesA, int nb_NodesB, + std::vector& inter, + double dim_caracteristic, double precision) + { for(int i_A = 1; i_A3) inter=INTERP_KERNEL::reconstruct_polygon(inter); - } + for(int i_B = 1; i_B3) inter=INTERP_KERNEL::reconstruct_polygon(inter); + } /*_ _ _ _ _ _ _ _ _ *_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _