From aa943ffad0d73c04152d67e7d5f9dda43c6e7e88 Mon Sep 17 00:00:00 2001 From: gdd Date: Thu, 10 Feb 2011 15:28:31 +0000 Subject: [PATCH] rnc : enabled management of periodic conditions in both parametric directions u and v --- src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx | 61 ++++++++++++++++++--- src/BLSURFPlugin/BLSURFPlugin_Attractor.hxx | 20 ++++--- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx b/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx index f8a343f..47e8c24 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Attractor.cxx @@ -96,9 +96,49 @@ bool BLSURFPlugin_Attractor::init(){ } double BLSURFPlugin_Attractor::GetSize(double u, double v){ + +// // calcul des coins du carre +// int i_sup = floor ( (u - _u1) * _mapGrid / (_u2 - _u1) + 1. ); +// int j_sup = floor ( (v - _v1) * _mapGrid / (_v2 - _v1) + 1. ); +// +// int i_inf = floor ( (u - _u1) * _mapGrid / (_u2 - _u1) ); +// int j_inf = floor ( (v - _v1) * _mapGrid / (_v2 - _v1) ); +// +// double u_sup = _vectU[i_sup]; +// double v_sup = _vectV[j_sup]; +// +// double u_inf = _vectU[i_inf]; +// double v_inf = _vectV[j_inf]; +// +// double d1 = _DMap[i_sup][j_sup]; +// double d2 = _DMap[i_sup][j_inf]; +// double d3 = _DMap[i_inf][j_sup]; +// double d4 = _DMap[i_inf][j_inf]; +// +// double P_inf = d4 * ( 1 + (u - u_inf) / (u_inf - u_sup) + (v - v_inf) / (v_inf - v_sup) ) +// + d3 * ( (v - v_inf) / (v_sup - v_inf) ) +// + d2 * ( (u - u_inf) / (u_sup - u_inf) ) ; +// +// double P_sup = d1 * ( 1 + (u - u_sup) / (u_sup - u_inf) + (v - v_sup) / (v_sup - v_inf) ) +// + d3 * ( (u - u_sup) / (u_inf - u_sup) ) +// + d2 * ( (v - v_sup) / (v_inf - v_sup) ) ; +// +// // calcul de la distance (interpolation lineaire) +// bool P_switch = (u+v > u_sup+v_sup); +// double d; +// if (P_switch){ +// d = P_inf; +// } +// else { +// d = P_sup; +// } + int i = floor ( (u - _u1) * _mapGrid / (_u2 - _u1) + 0.5 ); int j = floor ( (v - _v1) * _mapGrid / (_v2 - _v1) + 0.5 ); - return 0.1 * ( 1. + ( 0.5 * (_DMap[i][j] - 20. + abs(_DMap[i][j] - 20.)) ) ); // more generally: function of _DMap + + double d = _DMap[i][j]; + + return 1 + ( 0.5 * (d - 20. + abs(d - 20.)) ) ; // more generally: function of _DMap } @@ -112,7 +152,7 @@ bool BLSURFPlugin_Attractor::_buildMap(){ int i0, j0; gp_Pnt P; gp_Vec D1U,D1V; - double Guu, Gvv; //Diagonal components of the local metric tensor + double Guu, Gvv, Guv; // Components of the local metric tensor double du, dv; double D_Ref = 0.; double Dist = 0.; @@ -177,12 +217,12 @@ bool BLSURFPlugin_Attractor::_buildMap(){ j++; if (j<0){ MESSAGE("j = "<D1(_vectU[ip],_vectV[jp],P,D1U,D1V); // Calculate the metric at (i,j) - Guu = D1U.X()*D1U.X() + D1U.Y()*D1U.Y() + D1U.Z()*D1U.Z(); // Guu = ||dS/du||**2 G(i,j)= | ||dS/du||**2 0 | assuming that the isolines are orthogonal in 3D space - Gvv = D1V.X()*D1V.X() + D1V.Y()*D1V.Y() + D1V.Z()*D1V.Z(); // Gvv = ||dS/dv||**2 | 0 ||dS/dv||**2 | + Guu = D1U.X()*D1U.X() + D1U.Y()*D1U.Y() + D1U.Z()*D1U.Z(); // Guu = ||dS/du||**2 G(i,j)= | ||dS/du||**2 * | + Gvv = D1V.X()*D1V.X() + D1V.Y()*D1V.Y() + D1V.Z()*D1V.Z(); // Gvv = ||dS/dv||**2 | ||dS/dv||**2 | + Guv = D1U.X()*D1V.X() + D1U.Y()*D1V.Y() + D1U.Z()*D1V.Z(); // Guv = Gvu = < dS/du,dS/dv > + //Guv = 0; // test + if (Guv > 1e-15){ + MESSAGE("WARNING : Guv != 0 ; Guv = "<