7fd59977 |
1 | // File: AppParCurves_Variational_9.gxx |
2 | // Created: Fri Feb 19 11:09:11 1999 |
3 | // Author: Sergey KHROMOV |
4 | // <skv@pronox.nnov.matra-dtv.fr> |
5 | |
6 | static Standard_Boolean NotParallel(gp_Vec& T, gp_Vec& V) |
7 | { |
8 | V = T; |
9 | V.SetX(V.X() + 1.); |
10 | if (V.CrossMagnitude(T) > 1.e-12) |
11 | return Standard_True; |
12 | V.SetY(V.Y() + 1.); |
13 | if (V.CrossMagnitude(T) > 1.e-12) |
14 | return Standard_True; |
15 | V.SetZ(V.Z() + 1.); |
16 | if (V.CrossMagnitude(T) > 1.e-12) |
17 | return Standard_True; |
18 | return Standard_False; |
19 | } |
20 | |
21 | Standard_Boolean AppParCurves_Variational::InitTthetaF(const Standard_Integer ndimen, |
22 | const AppParCurves_Constraint typcon, |
23 | const Standard_Integer begin, |
24 | const Standard_Integer jndex) |
25 | { |
26 | if ((ndimen < 2)||(ndimen >3)) |
27 | return Standard_False; |
28 | gp_Vec T, V; |
29 | gp_Vec theta1, theta2; |
30 | gp_Vec F; |
31 | Standard_Real XX, XY, YY, XZ, YZ, ZZ; |
32 | |
33 | if ((typcon == AppParCurves_TangencyPoint)||(typcon == AppParCurves_CurvaturePoint)) |
34 | { |
35 | T.SetX(myTabConstraints->Value(jndex)); |
36 | T.SetY(myTabConstraints->Value(jndex + 1)); |
37 | if (ndimen == 3) |
38 | T.SetZ(myTabConstraints->Value(jndex + 2)); |
39 | else |
40 | T.SetZ(0.); |
41 | if (ndimen == 2) |
42 | { |
43 | V.SetX(0.); |
44 | V.SetY(0.); |
45 | V.SetZ(1.); |
46 | } |
47 | if (ndimen == 3) |
48 | if (!NotParallel(T, V)) |
49 | return Standard_False; |
50 | theta1 = V ^ T; |
51 | theta1.Normalize(); |
52 | myTtheta->SetValue(begin, theta1.X()); |
53 | myTtheta->SetValue(begin + 1, theta1.Y()); |
54 | if (ndimen == 3) |
55 | { |
56 | theta2 = T ^ theta1; |
57 | theta2.Normalize(); |
58 | myTtheta->SetValue(begin + 2, theta1.Z()); |
59 | myTtheta->SetValue(begin + 3, theta2.X()); |
60 | myTtheta->SetValue(begin + 4, theta2.Y()); |
61 | myTtheta->SetValue(begin + 5, theta2.Z()); |
62 | } |
63 | |
64 | // Calculation of myTfthet |
65 | if (typcon == AppParCurves_CurvaturePoint) |
66 | { |
67 | XX = Pow(T.X(), 2); |
68 | XY = T.X() * T.Y(); |
69 | YY = Pow(T.Y(), 2); |
70 | if (ndimen == 2) |
71 | { |
72 | F.SetX(YY * theta1.X() - XY * theta1.Y()); |
73 | F.SetY(XX * theta1.Y() - XY * theta1.X()); |
74 | myTfthet->SetValue(begin, F.X()); |
75 | myTfthet->SetValue(begin + 1, F.Y()); |
76 | } |
77 | if (ndimen == 3) |
78 | { |
79 | XZ = T.X() * T.Z(); |
80 | YZ = T.Y() * T.Z(); |
81 | ZZ = Pow(T.Z(), 2); |
82 | |
83 | F.SetX((ZZ + YY) * theta1.X() - XY * theta1.Y() - XZ * theta1.Z()); |
84 | F.SetY((XX + ZZ) * theta1.Y() - XY * theta1.X() - YZ * theta1.Z()); |
85 | F.SetZ((XX + YY) * theta1.Z() - XZ * theta1.X() - YZ * theta1.Y()); |
86 | myTfthet->SetValue(begin, F.X()); |
87 | myTfthet->SetValue(begin + 1, F.Y()); |
88 | myTfthet->SetValue(begin + 2, F.Z()); |
89 | F.SetX((ZZ + YY) * theta2.X() - XY * theta2.Y() - XZ * theta2.Z()); |
90 | F.SetY((XX + ZZ) * theta2.Y() - XY * theta2.X() - YZ * theta2.Z()); |
91 | F.SetZ((XX + YY) * theta2.Z() - XZ * theta2.X() - YZ * theta2.Y()); |
92 | myTfthet->SetValue(begin + 3, F.X()); |
93 | myTfthet->SetValue(begin + 4, F.Y()); |
94 | myTfthet->SetValue(begin + 5, F.Z()); |
95 | } |
96 | } |
97 | } |
98 | return Standard_True; |
99 | } |