|
|
|||
File indexing completed on 2026-07-01 08:32:43
0001 0002 // Copyright (c) 1991-1999 Matra Datavision 0003 // Copyright (c) 1999-2022 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef _GeomConvert_FuncSphereLSDist_HeaderFile 0017 #define _GeomConvert_FuncSphereLSDist_HeaderFile 0018 0019 #include <Standard.hxx> 0020 #include <Standard_DefineAlloc.hxx> 0021 0022 #include <math_MultipleVarFunctionWithGradient.hxx> 0023 #include <TColgp_HArray1OfXYZ.hxx> 0024 #include <math_Vector.hxx> 0025 0026 //! Function for search of sphere canonic parameters: coordinates of center and radius from set of 0027 //! moints by least square method. 0028 //! //! 0029 //! The class inherits math_MultipleVarFunctionWithGradient and thus is intended 0030 //! for use in math_BFGS algorithm. 0031 //! 0032 //! The criteria is: 0033 //! F(x0, y0, z0, R) = Sum[(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2]^2 => min, 0034 //! x(i), y(i), z(i) - coordinates of sample points, x0, y0, z0, R - coordinates of center and 0035 //! radius of sphere, which must be defined 0036 //! 0037 //! The first derivative are: 0038 //! dF/dx0 : G1(x0, y0, z0, R) = -4*Sum{[...]*(x(i) - x0)} 0039 //! dF/dy0 : G2(x0, y0, z0, R) = -4*Sum{[...]*(y(i) - y0)} 0040 //! dF/dz0 : G3(x0, y0, z0, R) = -4*Sum{[...]*(z(i) - z0)} 0041 //! dF/dR : G4(x0, y0, z0, R) = -4*R*Sum[...] 0042 //! [...] = [(x(i) - x0)^2 + (y(i) - y0)^2 + (z(i) - z0)^2 - R^2] 0043 //! 0044 class GeomConvert_FuncSphereLSDist : public math_MultipleVarFunctionWithGradient 0045 { 0046 public: 0047 DEFINE_STANDARD_ALLOC 0048 0049 //! Constructor. 0050 Standard_EXPORT GeomConvert_FuncSphereLSDist() {}; 0051 0052 Standard_EXPORT GeomConvert_FuncSphereLSDist(const Handle(TColgp_HArray1OfXYZ)& thePoints); 0053 0054 void SetPoints(const Handle(TColgp_HArray1OfXYZ)& thePoints) { myPoints = thePoints; } 0055 0056 //! Number of variables. 0057 Standard_EXPORT Standard_Integer NbVariables() const Standard_OVERRIDE; 0058 0059 //! Value. 0060 Standard_EXPORT Standard_Boolean Value(const math_Vector& X, Standard_Real& F) Standard_OVERRIDE; 0061 0062 //! Gradient. 0063 Standard_EXPORT Standard_Boolean Gradient(const math_Vector& X, math_Vector& G) Standard_OVERRIDE; 0064 0065 //! Value and gradient. 0066 Standard_EXPORT Standard_Boolean Values(const math_Vector& X, 0067 Standard_Real& F, 0068 math_Vector& G) Standard_OVERRIDE; 0069 0070 private: 0071 Handle(TColgp_HArray1OfXYZ) myPoints; 0072 }; 0073 #endif // _GeomConvert_FuncSphereLSDist_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|