0030778: [Regression to 7.3.0] Extrema raises exception StdFail_InfiniteSolutions
[occt.git] / src / Extrema / Extrema_ECC.hxx
CommitLineData
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_ECC_HeaderFile
18#define _Extrema_ECC_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_HArray1OfPnt.hxx>
30#include <Standard_Integer.hxx>
ce64c9ad 31
42cf5bc1 32class Adaptor3d_Curve;
33class Extrema_CurveTool;
34class Extrema_POnCurv;
35class gp_Pnt;
36class gp_Vec;
37
38
42cf5bc1 39class Extrema_ECC
40{
41public:
42
43 DEFINE_STANDARD_ALLOC
44
45
36b9ff75 46 //! Calculates all the distances as above
47 //! between Uinf and Usup for C1 and between Vinf and Vsup
48 //! for C2.
42cf5bc1 49 Standard_EXPORT Extrema_ECC();
50
36b9ff75 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.
42cf5bc1 55 Standard_EXPORT Extrema_ECC(const Adaptor3d_Curve& C1, const Adaptor3d_Curve& C2);
56
36b9ff75 57 //! Calculates all the distances as above
58 //! between Uinf and Usup for C1 and between Vinf and Vsup
59 //! for C2.
42cf5bc1 60 Standard_EXPORT Extrema_ECC(const Adaptor3d_Curve& C1, const Adaptor3d_Curve& C2, const Standard_Real Uinf, const Standard_Real Usup, const Standard_Real Vinf, const Standard_Real Vsup);
61
36b9ff75 62 //! Set params in case of empty constructor is usage.
42cf5bc1 63 Standard_EXPORT void SetParams (const Adaptor3d_Curve& C1, const Adaptor3d_Curve& 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);
836d7b64 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
36b9ff75 73 //! Performs calculations.
42cf5bc1 74 Standard_EXPORT void Perform();
75
36b9ff75 76 //! Returns True if the distances are found.
42cf5bc1 77 Standard_EXPORT Standard_Boolean IsDone() const;
78
36b9ff75 79 //! Returns state of myParallel flag.
42cf5bc1 80 Standard_EXPORT Standard_Boolean IsParallel() const;
81
36b9ff75 82 //! Returns the number of extremum distances.
42cf5bc1 83 Standard_EXPORT Standard_Integer NbExt() const;
84
36b9ff75 85 //! Returns the value of the Nth square extremum distance.
42cf5bc1 86 Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N = 1) const;
87
36b9ff75 88 //! Returns the points of the Nth extremum distance.
89 //! P1 is on the first curve, P2 on the second one.
42cf5bc1 90 Standard_EXPORT void Points (const Standard_Integer N, Extrema_POnCurv& P1, Extrema_POnCurv& P2) const;
91
92
93
94
95protected:
96
97
98
99
100
101private:
102
103
836d7b64 104 Standard_Boolean myIsFindSingleSolution; // Default value is false.
42cf5bc1 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_ECC_HeaderFile