1 2 // Copyright (c) 2020 OPEN CASCADE SAS 3 // 4 // This file is part of Open CASCADE Technology software library. 5 // 6 // This library is free software; you can redistribute it and/or modify it under 7 // the terms of the GNU Lesser General Public License version 2.1 as published 8 // by the Free Software Foundation, with special exception defined in the file 9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 10 // distribution for complete text of the license and disclaimer of any warranty. 11 // 12 // Alternatively, this file may be used under the terms of Open CASCADE 13 // commercial license or contractual agreement 14 15 #ifndef _Extrema_GlobOptFuncConicS_HeaderFile 16 #define _Extrema_GlobOptFuncConicS_HeaderFile 17 18 19 #include <Adaptor3d_Curve.hxx> 20 #include <Adaptor3d_Surface.hxx> 21 #include <math_Matrix.hxx> 22 #include <math_Vector.hxx> 23 #include <math_MultipleVarFunction.hxx> 24 #include <GeomAbs_CurveType.hxx> 25 #include <gp_Lin.hxx> 26 #include <gp_Circ.hxx> 27 #include <gp_Elips.hxx> 28 #include <gp_Hypr.hxx> 29 #include <gp_Parab.hxx> 30 31 //! This class implements function which calculate square Eucluidean distance 32 //! between point on surface and nearest point on Conic. 33 class Extrema_GlobOptFuncConicS : public math_MultipleVarFunction 34 { 35 public: 36 37 //! Curve and surface should exist during all the lifetime of Extrema_GlobOptFuncConicS. 38 Standard_EXPORT Extrema_GlobOptFuncConicS(const Adaptor3d_Curve *C, 39 const Adaptor3d_Surface *S); 40 41 Standard_EXPORT Extrema_GlobOptFuncConicS(const Adaptor3d_Surface *S); 42 43 Standard_EXPORT Extrema_GlobOptFuncConicS(const Adaptor3d_Surface *S, 44 const Standard_Real theUf, 45 const Standard_Real theUl, 46 const Standard_Real theVf, 47 const Standard_Real theVl); 48 49 Standard_EXPORT void LoadConic(const Adaptor3d_Curve *S, const Standard_Real theTf, const Standard_Real theTl); 50 51 Standard_EXPORT virtual Standard_Integer NbVariables() const; 52 53 Standard_EXPORT virtual Standard_Boolean Value(const math_Vector &theX, 54 Standard_Real &theF); 55 56 //! Parameter of conic for point on surface defined by theUV 57 Standard_EXPORT Standard_Real ConicParameter(const math_Vector& theUV) const; 58 59 private: 60 61 Standard_Boolean checkInputData(const math_Vector &X, 62 Standard_Real &su, 63 Standard_Real &sv); 64 65 void value(Standard_Real su, 66 Standard_Real sv, 67 Standard_Real &F); 68 69 70 const Adaptor3d_Curve *myC; 71 const Adaptor3d_Surface *myS; 72 GeomAbs_CurveType myCType; 73 gp_Lin myLin; 74 gp_Circ myCirc; 75 gp_Elips myElips; 76 gp_Hypr myHypr; 77 gp_Parab myParab; 78 gp_Pnt myCPf; 79 gp_Pnt myCPl; 80 //Boundaries 81 Standard_Real myTf; 82 Standard_Real myTl; 83 Standard_Real myUf; 84 Standard_Real myUl; 85 Standard_Real myVf; 86 Standard_Real myVl; 87 88 }; 89 90 #endif 91