1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
// File: GccIter_FunctionTanCuCu.gxx
// Created: Mon Jan 20 16:35:40 1992
// Author: Remi GILET
// <reg@phobox>
#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>
#include <ElCLib.hxx>
void GccIter_FunctionTanCuCu::
InitDerivative(const math_Vector& X ,
gp_Pnt2d& Point1,
gp_Pnt2d& Point2,
gp_Vec2d& Tan1 ,
gp_Vec2d& Tan2 ,
gp_Vec2d& D21 ,
gp_Vec2d& D22 ) {
switch (TheType) {
case GccIter_CuCu:
{
TheCurveTool::D2(TheCurve1,X(1),Point1,Tan1,D21);
TheCurveTool::D2(TheCurve2,X(2),Point2,Tan2,D22);
}
break;
case GccIter_CiCu:
{
ElCLib::D2(X(1),TheCirc1,Point1,Tan1,D21);
TheCurveTool::D2(TheCurve2,X(2),Point2,Tan2,D22);
}
break;
default:
{
}
}
}
GccIter_FunctionTanCuCu::
GccIter_FunctionTanCuCu(const TheCurve& C1 ,
const TheCurve& C2 ) {
TheCurve1 = C1;
TheCurve2 = C2;
TheType = GccIter_CuCu;
}
GccIter_FunctionTanCuCu::
GccIter_FunctionTanCuCu(const gp_Circ2d& C1 ,
const TheCurve& C2 ) {
TheCirc1 = C1;
TheCurve2 = C2;
TheType = GccIter_CiCu;
}
//=========================================================================
// soit P1 le point sur la courbe TheCurve1 d abscisse u1. +
// soit P2 le point sur la courbe TheCurve2 d abscisse u2. +
// soit T1 la tangente a la courbe TheCurve1 en P1. +
// soit T2 la tangente a la courbe TheCurve2 en P2. +
// Nous voulons P1 et P2 tels que : +
// ---> --> +
// * P1P2 /\ T1 = 0 +
// +
// --> --> +
// * T1 /\ T2 = 0 +
// +
// Nous cherchons donc les zeros des fonctions suivantes: +
// ---> --> +
// * P1P2 /\ T1 +
// --------------- = F1(u) +
// ---> --> +
// ||P1P2||*||T1|| +
// +
// --> --> +
// * T1 /\ T2 +
// --------------- = F2(u) +
// --> --> +
// ||T2||*||T1|| +
// +
// Les derivees de ces fonctions sont : +
// 2 2 +
// dF1 P1P2/\N1 (P1P2/\T1)*[T1*(-T1).P1P2+P1P2*(T1.N1)] +
// ----- = --------------- - ----------------------------------------- +
// du1 3 3 +
// ||P1P2||*||T1|| ||P1P2|| * ||T1|| +
// +
// 2 +
// dF1 T2/\T1 (P1P2/\T1)*[T1*(T2.P1P2) +
// ----- = --------------- - ----------------------------------------- +
// du2 3 3 +
// ||P1P2||*||T1|| ||P1P2|| * ||T1|| +
// +
// 2 +
// dF2 N1/\T2 T1/\T2*(N1.T1)T2 +
// ----- = ---------------- - ----------------------------- +
// du1 3 3 +
// ||T1||*||T2|| ||T1|| * ||T2|| +
// +
// 2 +
// dF2 T1/\N2 T1/\T2*(N2.T2)T1 +
// ----- = ---------------- - ----------------------------- +
// du2 3 3 +
// ||T1||*||T2|| ||T1|| * ||T2|| +
// +
//=========================================================================
Standard_Integer GccIter_FunctionTanCuCu::
NbVariables() const { return 2; }
Standard_Integer GccIter_FunctionTanCuCu::
NbEquations() const { return 2; }
Standard_Boolean GccIter_FunctionTanCuCu::
Value (const math_Vector& X ,
math_Vector& Fval ) {
gp_Pnt2d Point1;
gp_Pnt2d Point2;
gp_Vec2d Vect11;
gp_Vec2d Vect21;
gp_Vec2d Vect12;
gp_Vec2d Vect22;
InitDerivative(X,Point1,Point2,Vect11,Vect21,Vect12,Vect22);
Standard_Real NormeD11 = Vect11.Magnitude();
Standard_Real NormeD21 = Vect21.Magnitude();
gp_Vec2d TheDirection(Point1,Point2);
Standard_Real squaredir = TheDirection.Dot(TheDirection);
Fval(1) = TheDirection.Crossed(Vect11)/(NormeD11*squaredir);
Fval(2) = Vect11.Crossed(Vect21)/(NormeD11*NormeD21);
return Standard_True;
}
Standard_Boolean GccIter_FunctionTanCuCu::
Derivatives (const math_Vector& X ,
math_Matrix& Deriv ) {
gp_Pnt2d Point1;
gp_Pnt2d Point2;
gp_Vec2d Vect11;
gp_Vec2d Vect21;
gp_Vec2d Vect12;
gp_Vec2d Vect22;
InitDerivative(X,Point1,Point2,Vect11,Vect21,Vect12,Vect22);
Standard_Real NormeD11 = Vect11.Magnitude();
Standard_Real NormeD21 = Vect21.Magnitude();
#ifdef DEB
gp_Vec2d V2V1(Vect11.XY(),Vect21.XY());
#else
Vect11.XY();
Vect21.XY();
#endif
gp_Vec2d TheDirection(Point1,Point2);
Standard_Real squaredir = TheDirection.Dot(TheDirection);
Deriv(1,1) = TheDirection.Crossed(Vect12)/(NormeD11*squaredir)+
(TheDirection.Crossed(Vect11)*NormeD11*NormeD11*Vect11.Dot(TheDirection))/
(NormeD11*NormeD11*NormeD11*squaredir*squaredir*squaredir);
Deriv(1,2) = Vect21.Crossed(Vect11)/(NormeD11*squaredir)-
(TheDirection.Crossed(Vect11)*NormeD11*NormeD11*Vect21.Dot(TheDirection))/
(NormeD11*NormeD11*NormeD11*squaredir*squaredir*squaredir);
Deriv(2,1)=(Vect12.Crossed(Vect21))/(NormeD11*NormeD21)-
(Vect11.Crossed(Vect21))*(Vect12.Dot(Vect11))*NormeD21*NormeD21/
(NormeD11*NormeD11*NormeD11*NormeD21*NormeD21*NormeD21);
Deriv(2,2)=(Vect11.Crossed(Vect22))/(NormeD11*NormeD21)-
(Vect11.Crossed(Vect21))*(Vect22.Dot(Vect21))*NormeD11*NormeD11/
(NormeD11*NormeD11*NormeD11*NormeD21*NormeD21*NormeD21);
return Standard_True;
}
Standard_Boolean GccIter_FunctionTanCuCu::
Values (const math_Vector& X ,
math_Vector& Fval ,
math_Matrix& Deriv ) {
gp_Pnt2d Point1;
gp_Pnt2d Point2;
gp_Vec2d Vect11;
gp_Vec2d Vect21;
gp_Vec2d Vect12;
gp_Vec2d Vect22;
InitDerivative(X,Point1,Point2,Vect11,Vect21,Vect12,Vect22);
Standard_Real NormeD11 = Vect11.Magnitude();
Standard_Real NormeD21 = Vect21.Magnitude();
#ifdef DEB
gp_Vec2d V2V1(Vect11.XY(),Vect21.XY());
#else
Vect11.XY();
Vect21.XY();
#endif
gp_Vec2d TheDirection(Point1,Point2);
Standard_Real squaredir = TheDirection.Dot(TheDirection);
Fval(1) = TheDirection.Crossed(Vect11)/(NormeD11*squaredir);
Fval(2) = Vect11.Crossed(Vect21)/(NormeD11*NormeD21);
Deriv(1,1) = TheDirection.Crossed(Vect12)/(NormeD11*squaredir)+
(TheDirection.Crossed(Vect11)*NormeD11*NormeD11*Vect11.Dot(TheDirection))/
(NormeD11*NormeD11*NormeD11*squaredir*squaredir*squaredir);
Deriv(1,2) = Vect21.Crossed(Vect11)/(NormeD11*squaredir)-
(TheDirection.Crossed(Vect11)*NormeD11*NormeD11*Vect21.Dot(TheDirection))/
(NormeD11*NormeD11*NormeD11*squaredir*squaredir*squaredir);
Deriv(2,1)=(Vect12.Crossed(Vect21))/(NormeD11*NormeD21)-
(Vect11.Crossed(Vect21))*(Vect12.Dot(Vect11))*NormeD21*NormeD21/
(NormeD11*NormeD11*NormeD11*NormeD21*NormeD21*NormeD21);
Deriv(2,2)=(Vect11.Crossed(Vect22))/(NormeD11*NormeD21)-
(Vect11.Crossed(Vect21))*(Vect22.Dot(Vect21))*NormeD11*NormeD11/
(NormeD11*NormeD11*NormeD11*NormeD21*NormeD21*NormeD21);
return Standard_True;
}
|