42cf5bc1 |
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 | class StdFail_InfiniteSolutions; |
32 | class StdFail_NotDone; |
33 | class Standard_OutOfRange; |
34 | class Adaptor2d_Curve2d; |
35 | class Extrema_Curve2dTool; |
36 | class Extrema_POnCurv2d; |
37 | class gp_Pnt2d; |
38 | class gp_Vec2d; |
39 | |
40 | |
41 | |
42 | class Extrema_ECC2d |
43 | { |
44 | public: |
45 | |
46 | DEFINE_STANDARD_ALLOC |
47 | |
48 | |
36b9ff75 |
49 | //! Calculates all the distances as above |
50 | //! between Uinf and Usup for C1 and between Vinf and Vsup |
51 | //! for C2. |
42cf5bc1 |
52 | Standard_EXPORT Extrema_ECC2d(); |
53 | |
36b9ff75 |
54 | //! It calculates all the distances. |
55 | //! The function F(u,v)=distance(C1(u),C2(v)) has an |
56 | //! extremum when gradient(f)=0. The algorithm uses |
57 | //! Evtushenko's global optimization solver. |
42cf5bc1 |
58 | Standard_EXPORT Extrema_ECC2d(const Adaptor2d_Curve2d& C1, const Adaptor2d_Curve2d& C2); |
59 | |
36b9ff75 |
60 | //! Calculates all the distances as above |
61 | //! between Uinf and Usup for C1 and between Vinf and Vsup |
62 | //! for C2. |
42cf5bc1 |
63 | 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); |
64 | |
36b9ff75 |
65 | //! Set params in case of empty constructor is usage. |
42cf5bc1 |
66 | 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); |
67 | |
68 | Standard_EXPORT void SetTolerance (const Standard_Real Tol); |
836d7b64 |
69 | |
70 | //! Set flag for single extrema computation. Works on parametric solver only. |
71 | Standard_EXPORT void SetSingleSolutionFlag (const Standard_Boolean theSingleSolutionFlag); |
72 | |
73 | //! Get flag for single extrema computation. Works on parametric solver only. |
74 | Standard_EXPORT Standard_Boolean GetSingleSolutionFlag () const; |
75 | |
36b9ff75 |
76 | //! Performs calculations. |
42cf5bc1 |
77 | Standard_EXPORT void Perform(); |
78 | |
36b9ff75 |
79 | //! Returns True if the distances are found. |
42cf5bc1 |
80 | Standard_EXPORT Standard_Boolean IsDone() const; |
81 | |
36b9ff75 |
82 | //! Returns state of myParallel flag. |
42cf5bc1 |
83 | Standard_EXPORT Standard_Boolean IsParallel() const; |
84 | |
36b9ff75 |
85 | //! Returns the number of extremum distances. |
42cf5bc1 |
86 | Standard_EXPORT Standard_Integer NbExt() const; |
87 | |
36b9ff75 |
88 | //! Returns the value of the Nth square extremum distance. |
42cf5bc1 |
89 | Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N = 1) const; |
90 | |
36b9ff75 |
91 | //! Returns the points of the Nth extremum distance. |
92 | //! P1 is on the first curve, P2 on the second one. |
42cf5bc1 |
93 | Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv2d& P1, Extrema_POnCurv2d& P2) const; |
94 | |
95 | |
96 | |
97 | |
98 | protected: |
99 | |
100 | |
101 | |
102 | |
103 | |
104 | private: |
105 | |
106 | |
836d7b64 |
107 | Standard_Boolean myIsFindSingleSolution; // Default value is false. |
42cf5bc1 |
108 | Standard_Boolean myParallel; |
109 | Standard_Real myCurveMinTol; |
110 | math_Vector myLowBorder; |
111 | math_Vector myUppBorder; |
112 | TColStd_SequenceOfReal myPoints1; |
113 | TColStd_SequenceOfReal myPoints2; |
114 | Standard_Address myC[2]; |
115 | Standard_Boolean myDone; |
116 | |
117 | |
118 | }; |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | #endif // _Extrema_ECC2d_HeaderFile |