From 8e45500e2167947f42ac9db7062688fdc5799d68 Mon Sep 17 00:00:00 2001 From: nbv Date: Thu, 22 Mar 2018 09:53:48 +0300 Subject: [PATCH] 0029611: Misprint in the formula of Hessian computation in the file GeomLib_CheckCurveOnSurface.cxx The formula of Hessian computation has been corrected --- src/GeomLib/GeomLib_CheckCurveOnSurface.cxx | 28 +++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx b/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx index e8e186ddbe..a6f93338d9 100644 --- a/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx +++ b/src/GeomLib/GeomLib_CheckCurveOnSurface.cxx @@ -123,7 +123,7 @@ class GeomLib_CheckCurveOnSurface_TargetFunc : //returns 1st derivative of the the one-dimension-function when //parameter is equal to theX - Standard_Boolean Derive(const Standard_Real theX, Standard_Real& theDeriv) const + Standard_Boolean Derive(const Standard_Real theX, Standard_Real& theDeriv1, Standard_Real* const theDeriv2 = 0) const { try { @@ -134,14 +134,28 @@ class GeomLib_CheckCurveOnSurface_TargetFunc : } // gp_Pnt aP1, aP2; - gp_Vec aDC1, aDC2; + gp_Vec aDC1, aDC2, aDCC1, aDCC2; // - myCurve1.D1(theX, aP1, aDC1); - myCurve2.D1(theX, aP2, aDC2); + if (!theDeriv2) + { + myCurve1.D1(theX, aP1, aDC1); + myCurve2.D1(theX, aP2, aDC2); + } + else + { + myCurve1.D2(theX, aP1, aDC1, aDCC1); + myCurve2.D2(theX, aP2, aDC2, aDCC2); + } const gp_Vec aVec1(aP1, aP2), aVec2(aDC2-aDC1); // - theDeriv = -2.0*aVec1.Dot(aVec2); + theDeriv1 = -2.0*aVec1.Dot(aVec2); + + if (theDeriv2) + { + const gp_Vec aVec3(aDCC2 - aDCC1); + *theDeriv2 = -2.0*(aVec2.SquareMagnitude() + aVec1.Dot(aVec3)); + } } catch(Standard_Failure) { @@ -179,13 +193,11 @@ class GeomLib_CheckCurveOnSurface_TargetFunc : return Standard_False; } // - if (!Gradient(theX, theGrad)) + if (!Derive(theX(1), theGrad(1), &theHessian(1, 1))) { return Standard_False; } // - theHessian(1,1) = theGrad(1); - // return Standard_True; } // -- 2.39.5