1 // Created on: 1993-01-26
2 // Created by: Laurent PAINNOT
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Approx_FitAndDivide2d_HeaderFile
18 #define _Approx_FitAndDivide2d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <AppParCurves_SequenceOfMultiCurve.hxx>
25 #include <TColStd_SequenceOfReal.hxx>
26 #include <AppParCurves_MultiCurve.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Real.hxx>
30 #include <AppParCurves_Constraint.hxx>
31 #include <AppCont_Function.hxx>
32 class AppParCurves_MultiCurve;
36 class Approx_FitAndDivide2d
43 //! The MultiLine <Line> will be approximated until tolerances
45 //! The approximation will be done from degreemin to degreemax
46 //! with a cutting if the corresponding boolean is True.
47 Standard_EXPORT Approx_FitAndDivide2d(const AppCont_Function& Line, const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-5, const Standard_Real Tolerance2d = 1.0e-5, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
49 //! Initializes the fields of the algorithm.
50 Standard_EXPORT Approx_FitAndDivide2d(const Standard_Integer degreemin = 3, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-05, const Standard_Real Tolerance2d = 1.0e-05, const Standard_Boolean cutting = Standard_False, const AppParCurves_Constraint FirstC = AppParCurves_TangencyPoint, const AppParCurves_Constraint LastC = AppParCurves_TangencyPoint);
52 //! runs the algorithm after having initialized the fields.
53 Standard_EXPORT void Perform (const AppCont_Function& Line);
55 //! changes the degrees of the approximation.
56 Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
58 //! Changes the tolerances of the approximation.
59 Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
61 //! Changes the constraints of the approximation.
62 Standard_EXPORT void SetConstraints (const AppParCurves_Constraint FirstC, const AppParCurves_Constraint LastC);
64 //! returns False if at a moment of the approximation,
65 //! the status NoApproximation has been sent by the user
66 //! when more points were needed.
67 Standard_EXPORT Standard_Boolean IsAllApproximated() const;
69 //! returns False if the status NoPointsAdded has been sent.
70 Standard_EXPORT Standard_Boolean IsToleranceReached() const;
72 //! returns the tolerances 2d and 3d of the <Index> MultiCurve.
73 Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
75 //! Returns the number of MultiCurve doing the approximation
77 Standard_EXPORT Standard_Integer NbMultiCurves() const;
79 //! returns the approximation MultiCurve of range <Index>.
80 Standard_EXPORT AppParCurves_MultiCurve Value (const Standard_Integer Index = 1) const;
82 Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& firstp, Standard_Real& lastp) const;
96 //! is internally used by the algorithms.
97 Standard_EXPORT Standard_Boolean Compute (const AppCont_Function& Line, const Standard_Real Ufirst, const Standard_Real Ulast, Standard_Real& TheTol3d, Standard_Real& TheTol2d);
100 AppParCurves_SequenceOfMultiCurve myMultiCurves;
101 TColStd_SequenceOfReal myfirstparam;
102 TColStd_SequenceOfReal mylastparam;
103 AppParCurves_MultiCurve TheMultiCurve;
104 Standard_Boolean alldone;
105 Standard_Boolean tolreached;
106 TColStd_SequenceOfReal Tolers3d;
107 TColStd_SequenceOfReal Tolers2d;
108 Standard_Integer mydegremin;
109 Standard_Integer mydegremax;
110 Standard_Real mytol3d;
111 Standard_Real mytol2d;
112 Standard_Real currenttol3d;
113 Standard_Real currenttol2d;
114 Standard_Boolean mycut;
115 AppParCurves_Constraint myfirstC;
116 AppParCurves_Constraint mylastC;
127 #endif // _Approx_FitAndDivide2d_HeaderFile