1 //-- File IntImp_ComputeTangence.cxx
3 #include <IntImp_ConstIsoparametric.hxx>
5 static const IntImp_ConstIsoparametric staticChoixRef [4] = {
6 IntImp_UIsoparametricOnCaro1,
7 IntImp_VIsoparametricOnCaro1,
8 IntImp_UIsoparametricOnCaro2,
9 IntImp_VIsoparametricOnCaro2,
12 Standard_EXPORT const IntImp_ConstIsoparametric *ChoixRef = staticChoixRef ;
14 #include <IntImp_ComputeTangence.hxx>
16 //=======================================================================
17 //function : IntImp_ComputeTangence
19 //=======================================================================
20 Standard_Boolean IntImp_ComputeTangence(const gp_Vec DPuv[],
21 const Standard_Real EpsUV[],
22 Standard_Real Tgduv[],
23 IntImp_ConstIsoparametric TabIso[])
24 // arguments d entree:
25 // DPuv [0] =derivee en u sur caro 1
26 // DPuv [1] =derivee en v sur caro 1
27 // DPuv [2] =derivee en u sur caro 2
28 // DPuv [3] =derivee en v sur caro 2
29 // EpsUV[0] tolerance en u sur caro1
30 // EpsUV[1] tolerance en v sur caro1
31 // EpsUV[2] tolerance en u sur caro2
32 // EpsUV[3] tolerance en v sur caro2
33 // arguments de sortie:
34 // Tgduv[0] composante sup dp/du de caro1 de la tangente a l intersection
35 // Tgduv[1] composante sup dp/dv de caro1 de la tangente a l intersection
36 // Tgduv[2] composante sup dp/du de caro2 de la tangente a l intersection
37 // Tgduv[3] composante sup dp/dv de caro2 de la tangente a l intersection
38 // TabIso[0...3] meilleure iso range par ordre decroissant candidate
41 // calculer la tangente a l 'intersection ;en utilisant la propriete suivante
42 // du produit scalaire a^(b^c)=b(ac)-c(ab) on obtient les composantes de la
43 // tangente a l intersection dans les 2 plans tangents (t=n1^n2 ou n1 normale
44 // au premier carreau n2 au 2ieme)
45 // on s assurera que les plans tangents des 2 carreaux ne sont pas //
46 // les composantes de l intersection dans les plans tangents permettent de
47 //determiner l angle entre les isoparametriques d un carreau avec le carreau
49 //on triera par ordre croissant les cosinus :le plus petit cosinus determine le
50 // meilleure angle donc la meilleure iso a choisir pour trouver
54 Standard_Real NormDuv[4], aM2, aTol2;
60 NormDuv[i] = DPuv[i].SquareMagnitude();
61 if(NormDuv[i]<=aTol2) {
66 //-------------------------------------------------
70 //modified by NIZNHY-PKV Tue Nov 01 08:37:32 2011f
71 aM2=N1.SquareMagnitude();
75 //modified by NIZNHY-PKV Tue Nov 01 08:37:34 2011t
77 //-------------------------------------------------
80 //modified by NIZNHY-PKV Tue Nov 01 08:37:32 2011f
81 aM2=N2.SquareMagnitude();
85 //modified by NIZNHY-PKV Tue Nov 01 08:37:34 2011t
88 //modified by NIZNHY-PKV Tue Nov 01 08:31:25 2011f
90 NormDuv[i]=sqrt(NormDuv[i]);
92 //modified by NIZNHY-PKV Tue Nov 01 08:31:29 2011t
93 Tgduv[0] = -DPuv[1].Dot(N2);
94 Tgduv[1] = DPuv[0].Dot(N2);
95 Tgduv[2] = DPuv[3].Dot(N1);
96 Tgduv[3] = -DPuv[2].Dot(N1);
99 Standard_Boolean tangent = (Abs(Tgduv[0]) <= EpsUV[0]*NormDuv[1] &&
100 Abs(Tgduv[1]) <= EpsUV[1]*NormDuv[0] &&
101 Abs(Tgduv[2]) <= EpsUV[2]*NormDuv[3] &&
102 Abs(Tgduv[3]) <= EpsUV[3]*NormDuv[2] );
104 Standard_Real t=N1.Dot(N2);
107 tangent=Standard_True;
112 NormDuv[0] = Abs(Tgduv[1]) /NormDuv[0]; //iso u sur caro1
113 NormDuv[1] = Abs(Tgduv[0]) /NormDuv[1]; //iso v sur caro1
114 NormDuv[2] = Abs(Tgduv[3]) /NormDuv[2]; // iso u sur caro2
115 NormDuv[3] = Abs(Tgduv[2]) /NormDuv[3]; //iso v sur caro2
119 //-- Tri sur NormDuv ( en para. avec ChoixRef )
120 Standard_Boolean triOk = Standard_False;
122 IntImp_ConstIsoparametric ti;
123 for ( i=0;i<=3;i++) TabIso[i] = ChoixRef[i];
125 triOk = Standard_True;
127 if(NormDuv[i-1]>NormDuv[i]) {
128 triOk=Standard_False;
130 NormDuv[i]=NormDuv[i-1];
134 TabIso[i] = TabIso[i-1];
143 // trier par ordre croissant le tableau NormDuv
145 for (j =0;j<=3;j++) Irang[j]=j;
146 for (j =0;j<=3;j++) {
149 for (i =j+1;i<=3;i++) {
150 if (NormDuv[i] < Tampon) {
155 Irang[j] = Irang[II];
157 NormDuv[II] = NormDuv[j];
160 for (j=0; j<=3;j++) TabIso[j]=ChoixRef[Irang[j]];