0027234: Code duplication: Convert_CompBezierCurvesToBSplineCurve* in ShapeConstruct
[occt.git] / src / Convert / Convert_GridPolynomialToPoles.hxx
1 // Created on: 1996-07-08
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1996-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 _Convert_GridPolynomialToPoles_HeaderFile
18 #define _Convert_GridPolynomialToPoles_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TColStd_HArray1OfReal.hxx>
25 #include <TColStd_HArray1OfInteger.hxx>
26 #include <TColgp_HArray2OfPnt.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <TColStd_HArray2OfInteger.hxx>
30 class Standard_DomainError;
31 class StdFail_NotDone;
32
33
34 //! Convert a grid of Polynomial Surfaces
35 //! that are have continuity CM to an
36 //! Bspline Surface that has continuity
37 //! CM
38 class Convert_GridPolynomialToPoles 
39 {
40 public:
41
42   DEFINE_STANDARD_ALLOC
43
44   
45   //! To    only  one   polynomial  Surface.
46   //! The  Length  of  <PolynomialUIntervals> and <PolynomialVIntervals>
47   //! have to be 2.
48   //! This values defined the parametric domain of the Polynomial Equation.
49   //!
50   //! Coefficients :
51   //! The <Coefficients> have to be formated than an "C array"
52   //! [MaxUDegree+1] [MaxVDegree+1] [3]
53   Standard_EXPORT Convert_GridPolynomialToPoles(const Standard_Integer MaxUDegree, const Standard_Integer MaxVDegree, const Handle(TColStd_HArray1OfInteger)& NumCoeff, const Handle(TColStd_HArray1OfReal)& Coefficients, const Handle(TColStd_HArray1OfReal)& PolynomialUIntervals, const Handle(TColStd_HArray1OfReal)& PolynomialVIntervals);
54   
55   //! To one grid of polynomial Surface.
56   //! Warning!
57   //! Continuity in each parametric direction can be at MOST the
58   //! maximum degree of the polynomial functions.
59   //!
60   //! <TrueUIntervals>, <TrueVIntervals> :
61   //! this is the true parameterisation for the composite surface
62   //!
63   //! Coefficients :
64   //! The Coefficients have to be formated than an "C array"
65   //! [NbVSurfaces] [NBUSurfaces] [MaxUDegree+1] [MaxVDegree+1] [3]
66   //! raises DomainError    if <NumCoeffPerSurface> is not a
67   //! [1, NbVSurfaces*NbUSurfaces, 1,2] array.
68   //! if <Coefficients> is not a
69   Standard_EXPORT Convert_GridPolynomialToPoles(const Standard_Integer NbUSurfaces, const Standard_Integer NBVSurfaces, const Standard_Integer UContinuity, const Standard_Integer VContinuity, const Standard_Integer MaxUDegree, const Standard_Integer MaxVDegree, const Handle(TColStd_HArray2OfInteger)& NumCoeffPerSurface, const Handle(TColStd_HArray1OfReal)& Coefficients, const Handle(TColStd_HArray1OfReal)& PolynomialUIntervals, const Handle(TColStd_HArray1OfReal)& PolynomialVIntervals, const Handle(TColStd_HArray1OfReal)& TrueUIntervals, const Handle(TColStd_HArray1OfReal)& TrueVIntervals);
70   
71   Standard_EXPORT void Perform (const Standard_Integer UContinuity, const Standard_Integer VContinuity, const Standard_Integer MaxUDegree, const Standard_Integer MaxVDegree, const Handle(TColStd_HArray2OfInteger)& NumCoeffPerSurface, const Handle(TColStd_HArray1OfReal)& Coefficients, const Handle(TColStd_HArray1OfReal)& PolynomialUIntervals, const Handle(TColStd_HArray1OfReal)& PolynomialVIntervals, const Handle(TColStd_HArray1OfReal)& TrueUIntervals, const Handle(TColStd_HArray1OfReal)& TrueVIntervals);
72   
73   Standard_EXPORT Standard_Integer NbUPoles() const;
74   
75   Standard_EXPORT Standard_Integer NbVPoles() const;
76   
77   //! returns the poles of the BSpline Surface
78   Standard_EXPORT const Handle(TColgp_HArray2OfPnt)& Poles() const;
79   
80   Standard_EXPORT Standard_Integer UDegree() const;
81   
82   Standard_EXPORT Standard_Integer VDegree() const;
83   
84   Standard_EXPORT Standard_Integer NbUKnots() const;
85   
86   Standard_EXPORT Standard_Integer NbVKnots() const;
87   
88   //! Knots in the U direction
89   Standard_EXPORT const Handle(TColStd_HArray1OfReal)& UKnots() const;
90   
91   //! Knots in the V direction
92   Standard_EXPORT const Handle(TColStd_HArray1OfReal)& VKnots() const;
93   
94   //! Multiplicities of the knots in the U direction
95   Standard_EXPORT const Handle(TColStd_HArray1OfInteger)& UMultiplicities() const;
96   
97   //! Multiplicities of the knots in the V direction
98   Standard_EXPORT const Handle(TColStd_HArray1OfInteger)& VMultiplicities() const;
99   
100   Standard_EXPORT Standard_Boolean IsDone() const;
101
102
103
104
105 protected:
106
107
108
109
110
111 private:
112
113   
114   Standard_EXPORT void BuildArray (const Standard_Integer Degree, const Handle(TColStd_HArray1OfReal)& Knots, const Standard_Integer Continuty, Handle(TColStd_HArray1OfReal)& FlatKnots, Handle(TColStd_HArray1OfInteger)& Mults, Handle(TColStd_HArray1OfReal)& Parameters) const;
115
116
117   Handle(TColStd_HArray1OfReal) myUFlatKnots;
118   Handle(TColStd_HArray1OfReal) myVFlatKnots;
119   Handle(TColStd_HArray1OfReal) myUKnots;
120   Handle(TColStd_HArray1OfReal) myVKnots;
121   Handle(TColStd_HArray1OfInteger) myUMults;
122   Handle(TColStd_HArray1OfInteger) myVMults;
123   Handle(TColgp_HArray2OfPnt) myPoles;
124   Standard_Integer myUDegree;
125   Standard_Integer myVDegree;
126   Standard_Boolean myDone;
127
128
129 };
130
131
132
133
134
135
136
137 #endif // _Convert_GridPolynomialToPoles_HeaderFile