mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0025720: Incorrect code of math classes can lead to unpredicted behavior of algorithms
The calling of virtual methods has been removed from constructors & destructors: math_BissecNewton math_BrentMinimum math_FRPR math_FunctionSetRoot math_NewtonFunctionSetRoot math_NewtonMinimum math_Powell
This commit is contained in:
@@ -338,7 +338,8 @@ void Extrema_ExtPExtS::Perform (const gp_Pnt& P)
|
||||
Pe = ProjectPnt (anOrtogSection, myDirection, E),
|
||||
V = gp_Vec(E,Pe) * gp_Vec(myDirection);
|
||||
UV(1) = U; UV(2) = V;
|
||||
math_FunctionSetRoot aFSR (myF,UV,Tol,UVinf,UVsup);
|
||||
math_FunctionSetRoot aFSR (myF, Tol);
|
||||
aFSR.Perform(myF, UV, UVinf, UVsup);
|
||||
// for (Standard_Integer k=1 ; k <= myF.NbExt();
|
||||
Standard_Integer k;
|
||||
for ( k=1 ; k <= myF.NbExt(); k++) {
|
||||
|
@@ -289,7 +289,8 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
|
||||
math_PSO aPSO(&aFunc, TUVinf, TUVsup, aStep);
|
||||
aPSO.Perform(aParticles, aNbParticles, aValue, TUV);
|
||||
|
||||
math_FunctionSetRoot anA (myF, TUV, Tol, TUVinf, TUVsup, 100, Standard_False);
|
||||
math_FunctionSetRoot anA(myF, Tol);
|
||||
anA.Perform(myF, TUV, TUVinf, TUVsup);
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -778,8 +778,8 @@ void Extrema_GenExtPS::FindSolution(const gp_Pnt& /*P*/,
|
||||
UVsup(1) = myusup;
|
||||
UVsup(2) = myvsup;
|
||||
|
||||
const Standard_Integer aNbMaxIter = 100;
|
||||
math_FunctionSetRoot S (myF, UV, Tol, UVinf, UVsup, aNbMaxIter);
|
||||
math_FunctionSetRoot S(myF, Tol);
|
||||
S.Perform(myF, UV, UVinf, UVsup);
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -266,14 +266,16 @@ b- Calcul des minima:
|
||||
UV(3) = U20 + (N2Umin - 1) * PasU2;
|
||||
UV(4) = V20 + (N2Vmin - 1) * PasV2;
|
||||
|
||||
math_FunctionSetRoot SR1 (myF,UV,Tol,UVinf,UVsup);
|
||||
math_FunctionSetRoot SR1(myF, Tol);
|
||||
SR1.Perform(myF, UV, UVinf, UVsup);
|
||||
|
||||
UV(1) = U10 + (N1Umax - 1) * PasU1;
|
||||
UV(2) = V10 + (N1Vmax - 1) * PasV1;
|
||||
UV(3) = U20 + (N2Umax - 1) * PasU2;
|
||||
UV(4) = V20 + (N2Vmax - 1) * PasV2;
|
||||
|
||||
math_FunctionSetRoot SR2 (myF,UV,Tol,UVinf,UVsup);
|
||||
math_FunctionSetRoot SR2(myF, Tol);
|
||||
SR2.Perform(myF, UV, UVinf, UVsup);
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@@ -82,7 +82,9 @@ Methode:
|
||||
Uusup(1)=Usup;
|
||||
Uusup(2)=Vsup;
|
||||
|
||||
math_FunctionSetRoot S (F,Start,Tol,Uuinf,Uusup);
|
||||
math_FunctionSetRoot S(F, Tol);
|
||||
S.Perform(F, Start, Uuinf, Uusup);
|
||||
|
||||
if (S.IsDone() && F.NbExt() > 0) {
|
||||
mySqDist = F.SquareDistance(1);
|
||||
F.Points(1,myPoint1,myPoint2);
|
||||
|
@@ -89,7 +89,8 @@ void Extrema_GenLocateExtCS::Perform(const Adaptor3d_Curve& C,
|
||||
BSup(2) = Usup;
|
||||
BSup(3) = Vsup;
|
||||
|
||||
math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
|
@@ -75,7 +75,8 @@ Method:
|
||||
BSup(1) = Usup;
|
||||
BSup(2) = Vsup;
|
||||
|
||||
math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
|
@@ -97,7 +97,8 @@ void Extrema_GenLocateExtSS::Perform(const Adaptor3d_Surface& S1,
|
||||
BSup(3) = Usup2;
|
||||
BSup(4) = Vsup2;
|
||||
|
||||
math_FunctionSetRoot SR (F, Start,Tol, BInf, BSup);
|
||||
math_FunctionSetRoot SR (F, Tol);
|
||||
SR.Perform(F, Start, BInf, BSup);
|
||||
if (!SR.IsDone())
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user