Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-12 08:46:38

0001 // Created on: 1991-02-26
0002 // Created by: Isabelle GRIGNON
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Extrema_ECC2d_HeaderFile
0018 #define _Extrema_ECC2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <math_Vector.hxx>
0024 #include <TColStd_SequenceOfReal.hxx>
0025 
0026 class Adaptor2d_Curve2d;
0027 class Extrema_Curve2dTool;
0028 class Extrema_POnCurv2d;
0029 class gp_Pnt2d;
0030 class gp_Vec2d;
0031 
0032 class Extrema_ECC2d
0033 {
0034 public:
0035   DEFINE_STANDARD_ALLOC
0036 
0037   //! Calculates all the distances as above
0038   //! between Uinf and Usup for C1 and  between Vinf and Vsup
0039   //! for C2.
0040   Standard_EXPORT Extrema_ECC2d();
0041 
0042   //! It calculates all the distances.
0043   //! The function F(u,v)=distance(C1(u),C2(v)) has an
0044   //! extremum when gradient(f)=0. The algorithm uses
0045   //! Evtushenko's global optimization solver.
0046   Standard_EXPORT Extrema_ECC2d(const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2);
0047 
0048   //! Calculates all the distances as above
0049   //! between Uinf and Usup for C1 and  between Vinf and Vsup
0050   //! for C2.
0051   Standard_EXPORT Extrema_ECC2d(const Adaptor2d_Curve2d& C1,
0052                                 const Adaptor2d_Curve2d& C2,
0053                                 const Standard_Real      Uinf,
0054                                 const Standard_Real      Usup,
0055                                 const Standard_Real      Vinf,
0056                                 const Standard_Real      Vsup);
0057 
0058   //! Set params in case of empty constructor is usage.
0059   Standard_EXPORT void SetParams(const Adaptor2d_Curve2d& C1,
0060                                  const Adaptor2d_Curve2d& C2,
0061                                  const Standard_Real      Uinf,
0062                                  const Standard_Real      Usup,
0063                                  const Standard_Real      Vinf,
0064                                  const Standard_Real      Vsup);
0065 
0066   Standard_EXPORT void SetTolerance(const Standard_Real Tol);
0067 
0068   //! Set flag for single extrema computation. Works on parametric solver only.
0069   Standard_EXPORT void SetSingleSolutionFlag(const Standard_Boolean theSingleSolutionFlag);
0070 
0071   //! Get flag for single extrema computation. Works on parametric solver only.
0072   Standard_EXPORT Standard_Boolean GetSingleSolutionFlag() const;
0073 
0074   //! Performs calculations.
0075   Standard_EXPORT void Perform();
0076 
0077   //! Returns True if the distances are found.
0078   Standard_EXPORT Standard_Boolean IsDone() const;
0079 
0080   //! Returns state of myParallel flag.
0081   Standard_EXPORT Standard_Boolean IsParallel() const;
0082 
0083   //! Returns the number of extremum distances.
0084   Standard_EXPORT Standard_Integer NbExt() const;
0085 
0086   //! Returns the value of the Nth square extremum distance.
0087   Standard_EXPORT Standard_Real SquareDistance(const Standard_Integer N = 1) const;
0088 
0089   //! Returns the points of the Nth extremum distance.
0090   //! P1 is on the first curve, P2 on the second one.
0091   Standard_EXPORT void Points(const Standard_Integer N,
0092                               Extrema_POnCurv2d&     P1,
0093                               Extrema_POnCurv2d&     P2) const;
0094 
0095 protected:
0096 private:
0097   Standard_Boolean       myIsFindSingleSolution; // Default value is false.
0098   Standard_Boolean       myParallel;
0099   Standard_Real          myCurveMinTol;
0100   math_Vector            myLowBorder;
0101   math_Vector            myUppBorder;
0102   TColStd_SequenceOfReal myPoints1;
0103   TColStd_SequenceOfReal myPoints2;
0104   Standard_Address       myC[2];
0105   Standard_Boolean       myDone;
0106 };
0107 
0108 #endif // _Extrema_ECC2d_HeaderFile