mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
CR23589: performance improvements in curve-curve intersection
This commit is contained in:
parent
337a0f4e30
commit
0d167958d9
@ -111,6 +111,8 @@ fields
|
||||
myV : Real;
|
||||
myP1 : Pnt; -- current point C1(U)
|
||||
myP2 : Pnt; -- current point C2(U)
|
||||
myDu : Vec; -- current D1 C1(U)
|
||||
myDv : Vec; -- current D1 C2(V)
|
||||
|
||||
mySqDist: SequenceOfReal from TColStd;
|
||||
myPoints: SeqPOnC;
|
||||
|
@ -59,28 +59,26 @@ Standard_Boolean Extrema_FuncExtCC::Value (const math_Vector& UV,
|
||||
math_Vector& F)
|
||||
{
|
||||
|
||||
Vec Du, Dv;
|
||||
|
||||
myU = UV(1);
|
||||
myV = UV(2);
|
||||
Tool1::D1(*((Curve1*)myC1), myU,myP1,Du);
|
||||
Tool2::D1(*((Curve2*)myC2), myV,myP2,Dv);
|
||||
Tool1::D1(*((Curve1*)myC1), myU,myP1,myDu);
|
||||
Tool2::D1(*((Curve2*)myC2), myV,myP2,myDv);
|
||||
Vec P1P2 (myP1,myP2);
|
||||
|
||||
Standard_Real Ndu = Du.Magnitude();
|
||||
Standard_Real Ndu = myDu.Magnitude();
|
||||
if (Ndu <= Tol) {
|
||||
Pnt P1, P2;
|
||||
P1 = Tool1::Value(*((Curve1*)myC1), myU-delta);
|
||||
P2 = Tool1::Value(*((Curve1*)myC1), myU+delta);
|
||||
Vec V(P1,P2);
|
||||
Du = V;
|
||||
Ndu = Du.Magnitude();
|
||||
myDu = V;
|
||||
Ndu = myDu.Magnitude();
|
||||
if (Ndu <= Tol) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real Ndv = Dv.Magnitude();
|
||||
Standard_Real Ndv = myDv.Magnitude();
|
||||
if (Ndv <= Tol) {
|
||||
// Traitement des singularite, on approche la Tangente
|
||||
// par une corde
|
||||
@ -88,15 +86,15 @@ Standard_Boolean Extrema_FuncExtCC::Value (const math_Vector& UV,
|
||||
P1 = Tool2::Value(*((Curve2*)myC2), myV-delta);
|
||||
P2 = Tool2::Value(*((Curve2*)myC2), myV+delta);
|
||||
Vec V(P1,P2);
|
||||
Dv = V;
|
||||
Ndv = Dv.Magnitude();
|
||||
myDv = V;
|
||||
Ndv = myDv.Magnitude();
|
||||
if (Ndv <= Tol) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
F(1) = P1P2.Dot(Du)/Ndu;
|
||||
F(2) = P1P2.Dot(Dv)/Ndv;
|
||||
F(1) = P1P2.Dot(myDu)/Ndu;
|
||||
F(2) = P1P2.Dot(myDv)/Ndv;
|
||||
return Standard_True;
|
||||
}
|
||||
//=============================================================================
|
||||
@ -108,56 +106,55 @@ Standard_Boolean Extrema_FuncExtCC::Derivatives (const math_Vector& UV,
|
||||
return Values(UV,F,Df);
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
Standard_Boolean Extrema_FuncExtCC::Values (const math_Vector& UV,
|
||||
math_Vector& F,
|
||||
math_Matrix& Df)
|
||||
{
|
||||
myU = UV(1);
|
||||
myV = UV(2);
|
||||
Vec Du, Dv, Duu, Dvv;
|
||||
Tool1::D2(*((Curve1*)myC1), myU,myP1,Du,Duu);
|
||||
Tool2::D2(*((Curve2*)myC2), myV,myP2,Dv,Dvv);
|
||||
Vec Duu, Dvv;
|
||||
Tool1::D2(*((Curve1*)myC1), myU,myP1,myDu,Duu);
|
||||
Tool2::D2(*((Curve2*)myC2), myV,myP2,myDv,Dvv);
|
||||
|
||||
Vec P1P2 (myP1,myP2);
|
||||
|
||||
Standard_Real Ndu = Du.Magnitude();
|
||||
Standard_Real Ndu = myDu.Magnitude();
|
||||
if (Ndu <= Tol) {
|
||||
Pnt P1, P2;
|
||||
Vec V1;
|
||||
Tool1::D1(*((Curve1*)myC1),myU+delta, P2, Duu);
|
||||
Tool1::D1(*((Curve1*)myC1),myU-delta, P1, V1);
|
||||
Vec V(P1,P2);
|
||||
Du = V;
|
||||
myDu = V;
|
||||
Duu -= V1;
|
||||
Ndu = Du.Magnitude();
|
||||
Ndu = myDu.Magnitude();
|
||||
if (Ndu <= Tol) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Real Ndv = Dv.Magnitude();
|
||||
Standard_Real Ndv = myDv.Magnitude();
|
||||
if (Ndv <= Tol) {
|
||||
Pnt P1, P2;
|
||||
Vec V1;
|
||||
Tool2::D1(*((Curve2*)myC2),myV+delta, P2, Dvv);
|
||||
Tool2::D1(*((Curve2*)myC2),myV-delta, P1, V1);
|
||||
Vec V(P1,P2);
|
||||
Dv = V;
|
||||
myDv = V;
|
||||
Dvv -= V1;
|
||||
Ndv = Dv.Magnitude();
|
||||
Ndv = myDv.Magnitude();
|
||||
if (Ndv <= Tol) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
|
||||
F(1) = P1P2.Dot(Du)/Ndu;
|
||||
F(2) = P1P2.Dot(Dv)/Ndv;
|
||||
F(1) = P1P2.Dot(myDu)/Ndu;
|
||||
F(2) = P1P2.Dot(myDv)/Ndv;
|
||||
|
||||
Df(1,1) = - Ndu + (P1P2.Dot(Duu)/Ndu) - F(1)*(Du.Dot(Duu)/(Ndu*Ndu));
|
||||
Df(1,2) = Dv.Dot(Du)/Ndu;
|
||||
Df(2,1) = -Du.Dot(Dv)/Ndv;
|
||||
Df(2,2) = Ndv + (P1P2.Dot(Dvv)/Ndv) - F(2)*(Dv.Dot(Dvv)/(Ndv*Ndv));
|
||||
Df(1,1) = - Ndu + (P1P2.Dot(Duu)/Ndu) - F(1)*(myDu.Dot(Duu)/(Ndu*Ndu));
|
||||
Df(1,2) = myDv.Dot(myDu)/Ndu;
|
||||
Df(2,1) = -myDu.Dot(myDv)/Ndv;
|
||||
Df(2,2) = Ndv + (P1P2.Dot(Dvv)/Ndv) - F(2)*(myDv.Dot(Dvv)/(Ndv*Ndv));
|
||||
return Standard_True;
|
||||
|
||||
}
|
||||
@ -165,11 +162,9 @@ Standard_Boolean Extrema_FuncExtCC::Values (const math_Vector& UV,
|
||||
|
||||
Standard_Integer Extrema_FuncExtCC::GetStateNumber ()
|
||||
{
|
||||
Vec Du, Dv;
|
||||
Pnt P1, P2;
|
||||
Tool1::D1(*((Curve1*)myC1), myU, P1, Du);
|
||||
Tool2::D1(*((Curve2*)myC2), myV, P2, Dv);
|
||||
Vec P1P2 (P1, P2);
|
||||
Vec Du (myDu), Dv (myDv);
|
||||
Vec P1P2 (myP1, myP2);
|
||||
|
||||
Standard_Real mod = Du.Magnitude();
|
||||
if(mod > Tol) {
|
||||
Du /= mod;
|
||||
|
Loading…
x
Reference in New Issue
Block a user