Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:57:45

0001 // Copyright (c) 2020 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement
0013 
0014 #ifndef _Extrema_GlobOptFuncCQuadric_HeaderFile
0015 #define _Extrema_GlobOptFuncCQuadric_HeaderFile
0016 
0017 #include <Adaptor3d_Surface.hxx>
0018 #include <math_MultipleVarFunction.hxx>
0019 #include <GeomAbs_SurfaceType.hxx>
0020 #include <gp_Pln.hxx>
0021 #include <gp_Cylinder.hxx>
0022 #include <gp_Cone.hxx>
0023 #include <gp_Sphere.hxx>
0024 #include <gp_Torus.hxx>
0025 
0026 //! This class implements function which calculate square Eucluidean distance
0027 //! between point on surface and nearest point on Conic.
0028 class Extrema_GlobOptFuncCQuadric : public math_MultipleVarFunction
0029 {
0030 public:
0031   //! Curve and surface should exist during all the lifetime of Extrema_GlobOptFuncCQuadric.
0032   Standard_EXPORT Extrema_GlobOptFuncCQuadric(const Adaptor3d_Curve* C);
0033 
0034   Standard_EXPORT Extrema_GlobOptFuncCQuadric(const Adaptor3d_Curve* C,
0035                                               const double           theTf,
0036                                               const double           theTl);
0037 
0038   Standard_EXPORT Extrema_GlobOptFuncCQuadric(const Adaptor3d_Curve* C, const Adaptor3d_Surface* S);
0039 
0040   Standard_EXPORT void LoadQuad(const Adaptor3d_Surface* S,
0041                                 const double             theUf,
0042                                 const double             theUl,
0043                                 const double             theVf,
0044                                 const double             theVl);
0045 
0046   Standard_EXPORT int NbVariables() const override;
0047 
0048   Standard_EXPORT bool Value(const math_Vector& theX, double& theF) override;
0049   //! Parameters of quadric for point on curve defined by theCT
0050   Standard_EXPORT void QuadricParameters(const math_Vector& theCT, math_Vector& theUV) const;
0051 
0052 private:
0053   bool checkInputData(const math_Vector& X, double& ct);
0054 
0055   void value(double ct, double& F);
0056 
0057   const Adaptor3d_Curve*   myC;
0058   const Adaptor3d_Surface* myS;
0059   GeomAbs_SurfaceType      mySType;
0060   gp_Pln                   myPln;
0061   gp_Cone                  myCone;
0062   gp_Cylinder              myCylinder;
0063   gp_Sphere                mySphere;
0064   gp_Torus                 myTorus;
0065   gp_Pnt                   myPTrim[4];
0066   // Boundaries
0067   double myTf;
0068   double myTl;
0069   double myUf;
0070   double myUl;
0071   double myVf;
0072   double myVl;
0073 };
0074 
0075 #endif