1 // Created on: 1991-02-26 2 // Created by: Isabelle GRIGNON 3 // Copyright (c) 1991-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _Extrema_ECC2d_HeaderFile 18 #define _Extrema_ECC2d_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <Standard_Boolean.hxx> 25 #include <Standard_Real.hxx> 26 #include <math_Vector.hxx> 27 #include <TColStd_SequenceOfReal.hxx> 28 #include <Standard_Address.hxx> 29 #include <TColgp_HArray1OfPnt2d.hxx> 30 #include <Standard_Integer.hxx> 31 32 class Adaptor2d_Curve2d; 33 class Extrema_Curve2dTool; 34 class Extrema_POnCurv2d; 35 class gp_Pnt2d; 36 class gp_Vec2d; 37 38 39 class Extrema_ECC2d 40 { 41 public: 42 43 DEFINE_STANDARD_ALLOC 44 45 46 //! Calculates all the distances as above 47 //! between Uinf and Usup for C1 and between Vinf and Vsup 48 //! for C2. 49 Standard_EXPORT Extrema_ECC2d(); 50 51 //! It calculates all the distances. 52 //! The function F(u,v)=distance(C1(u),C2(v)) has an 53 //! extremum when gradient(f)=0. The algorithm uses 54 //! Evtushenko's global optimization solver. 55 Standard_EXPORT Extrema_ECC2d(const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2); 56 57 //! Calculates all the distances as above 58 //! between Uinf and Usup for C1 and between Vinf and Vsup 59 //! for C2. 60 Standard_EXPORT Extrema_ECC2d(const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup); 61 62 //! Set params in case of empty constructor is usage. 63 Standard_EXPORT void SetParams (const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup); 64 65 Standard_EXPORT void SetTolerance (const Standard_Real Tol); 66 67 //! Set flag for single extrema computation. Works on parametric solver only. 68 Standard_EXPORT void SetSingleSolutionFlag (const Standard_Boolean theSingleSolutionFlag); 69 70 //! Get flag for single extrema computation. Works on parametric solver only. 71 Standard_EXPORT Standard_Boolean GetSingleSolutionFlag () const; 72 73 //! Performs calculations. 74 Standard_EXPORT void Perform(); 75 76 //! Returns True if the distances are found. 77 Standard_EXPORT Standard_Boolean IsDone() const; 78 79 //! Returns state of myParallel flag. 80 Standard_EXPORT Standard_Boolean IsParallel() const; 81 82 //! Returns the number of extremum distances. 83 Standard_EXPORT Standard_Integer NbExt() const; 84 85 //! Returns the value of the Nth square extremum distance. 86 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N = 1) const; 87 88 //! Returns the points of the Nth extremum distance. 89 //! P1 is on the first curve, P2 on the second one. 90 Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv2d& P1, Extrema_POnCurv2d& P2) const; 91 92 93 94 95 protected: 96 97 98 99 100 101 private: 102 103 104 Standard_Boolean myIsFindSingleSolution; // Default value is false. 105 Standard_Boolean myParallel; 106 Standard_Real myCurveMinTol; 107 math_Vector myLowBorder; 108 math_Vector myUppBorder; 109 TColStd_SequenceOfReal myPoints1; 110 TColStd_SequenceOfReal myPoints2; 111 Standard_Address myC[2]; 112 Standard_Boolean myDone; 113 114 115 }; 116 117 118 119 120 121 122 123 #endif // _Extrema_ECC2d_HeaderFile 124