0024988: Wrong result done by projection algorithm
[occt.git] / src / AppCont / AppCont_LeastSquare.hxx
1 // Created on: 1995-03-14
2 // Created by: Modelistation
3 // Copyright (c) 1995-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 AppCont_LeastSquare_HeaderFile
18 #define AppCont_LeastSquare_HeaderFile
19
20 #include <AppCont_Function.hxx>
21 #include <AppParCurves_MultiCurve.hxx>
22 #include <math_Vector.hxx>
23 #include <math_Matrix.hxx>
24 #include <NCollection_Array1.hxx>
25 #include <AppParCurves_Constraint.hxx>
26
27
28 struct PeriodicityInfo
29 {
30   Standard_Boolean isPeriodic;
31   Standard_Real    myPeriod;
32 };
33
34 class AppCont_LeastSquare
35 {
36 public:
37
38   Standard_EXPORT AppCont_LeastSquare(const AppCont_Function&       SSP,
39                                       const Standard_Real           U0,
40                                       const Standard_Real           U1,
41                                       const AppParCurves_Constraint FirstCons,
42                                       const AppParCurves_Constraint LastCons,
43                                       const Standard_Integer        Deg,
44                                       const Standard_Integer        NbPoints);
45
46   Standard_EXPORT const AppParCurves_MultiCurve& Value();
47
48   Standard_EXPORT void Error(Standard_Real& F, 
49                              Standard_Real& MaxE3d,
50                              Standard_Real& MaxE2d) const;
51
52   Standard_EXPORT Standard_Boolean IsDone() const;
53
54 private:
55
56   //! Fix border point evaluation.
57   void FixSingleBorderPoint(const AppCont_Function&   theSSP,
58                             const Standard_Real       theU,
59                             const Standard_Real       theU0,
60                             const Standard_Real       theU1,
61                             NCollection_Array1<gp_Pnt2d>& theFix2d,
62                             NCollection_Array1<gp_Pnt>&   theFix);
63
64   AppParCurves_MultiCurve mySCU;
65   math_Matrix myPoints;
66   math_Matrix myPoles;
67   math_Vector myParam;
68   math_Matrix myVB;
69   NCollection_Array1<PeriodicityInfo> myPerInfo;
70   Standard_Boolean myDone;
71   Standard_Integer myDegre;
72   Standard_Integer myNbdiscret, myNbP, myNbP2d;
73 };
74
75 #endif