0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BRepBlend / BRepBlend_AppSurf.hxx
1 // Created on: 1993-12-06
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1993-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 _BRepBlend_AppSurf_HeaderFile
18 #define _BRepBlend_AppSurf_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_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <TColgp_HArray2OfPnt.hxx>
28 #include <TColStd_HArray2OfReal.hxx>
29 #include <TColStd_HArray1OfReal.hxx>
30 #include <TColStd_HArray1OfInteger.hxx>
31 #include <TColgp_SequenceOfArray1OfPnt2d.hxx>
32 #include <Approx_ParametrizationType.hxx>
33 #include <GeomAbs_Shape.hxx>
34 #include <AppBlend_Approx.hxx>
35 #include <TColgp_Array2OfPnt.hxx>
36 #include <TColStd_Array2OfReal.hxx>
37 #include <TColStd_Array1OfReal.hxx>
38 #include <TColStd_Array1OfInteger.hxx>
39 #include <TColgp_Array1OfPnt2d.hxx>
40 class StdFail_NotDone;
41 class Standard_DomainError;
42 class Standard_OutOfRange;
43 class Blend_AppFunction;
44 class BRepBlend_Line;
45
46
47
48 class BRepBlend_AppSurf  : public AppBlend_Approx
49 {
50 public:
51
52   DEFINE_STANDARD_ALLOC
53
54   
55   Standard_EXPORT BRepBlend_AppSurf();
56   
57   Standard_EXPORT BRepBlend_AppSurf(const Standard_Integer Degmin, const Standard_Integer Degmax, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer NbIt, const Standard_Boolean KnownParameters = Standard_False);
58   
59   Standard_EXPORT void Init (const Standard_Integer Degmin, const Standard_Integer Degmax, const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer NbIt, const Standard_Boolean KnownParameters = Standard_False);
60   
61   //! Define the type of parametrization used in the approximation
62   Standard_EXPORT void SetParType (const Approx_ParametrizationType ParType);
63   
64   //! Define the Continuity used in the approximation
65   Standard_EXPORT void SetContinuity (const GeomAbs_Shape C);
66   
67   //! define the Weights  associed to the criterium used in
68   //! the  optimization.
69   //!
70   //! if Wi <= 0
71   Standard_EXPORT void SetCriteriumWeight (const Standard_Real W1, const Standard_Real W2, const Standard_Real W3);
72   
73   //! returns the type of parametrization used in the approximation
74   Standard_EXPORT Approx_ParametrizationType ParType() const;
75   
76   //! returns the Continuity used in the approximation
77   Standard_EXPORT GeomAbs_Shape Continuity() const;
78   
79   //! returns the Weights (as percent) associed  to the criterium used in
80   //! the  optimization.
81   Standard_EXPORT void CriteriumWeight (Standard_Real& W1, Standard_Real& W2, Standard_Real& W3) const;
82   
83   Standard_EXPORT void Perform (const Handle(BRepBlend_Line)& Lin, Blend_AppFunction& SecGen, const Standard_Boolean SpApprox = Standard_False);
84   
85   Standard_EXPORT void PerformSmoothing (const Handle(BRepBlend_Line)& Lin, Blend_AppFunction& SecGen);
86   
87   Standard_EXPORT void Perform (const Handle(BRepBlend_Line)& Lin, Blend_AppFunction& SecGen, const Standard_Integer NbMaxP);
88   
89     Standard_Boolean IsDone() const;
90   
91   Standard_EXPORT void SurfShape (Standard_Integer& UDegree, Standard_Integer& VDegree, Standard_Integer& NbUPoles, Standard_Integer& NbVPoles, Standard_Integer& NbUKnots, Standard_Integer& NbVKnots) const;
92   
93   Standard_EXPORT void Surface (TColgp_Array2OfPnt& TPoles, TColStd_Array2OfReal& TWeights, TColStd_Array1OfReal& TUKnots, TColStd_Array1OfReal& TVKnots, TColStd_Array1OfInteger& TUMults, TColStd_Array1OfInteger& TVMults) const;
94   
95     Standard_Integer UDegree() const;
96   
97     Standard_Integer VDegree() const;
98   
99     const TColgp_Array2OfPnt& SurfPoles() const;
100   
101     const TColStd_Array2OfReal& SurfWeights() const;
102   
103     const TColStd_Array1OfReal& SurfUKnots() const;
104   
105     const TColStd_Array1OfReal& SurfVKnots() const;
106   
107     const TColStd_Array1OfInteger& SurfUMults() const;
108   
109     const TColStd_Array1OfInteger& SurfVMults() const;
110   
111     Standard_Integer NbCurves2d() const;
112   
113   Standard_EXPORT void Curves2dShape (Standard_Integer& Degree, Standard_Integer& NbPoles, Standard_Integer& NbKnots) const;
114   
115   Standard_EXPORT void Curve2d (const Standard_Integer Index, TColgp_Array1OfPnt2d& TPoles, TColStd_Array1OfReal& TKnots, TColStd_Array1OfInteger& TMults) const;
116   
117     Standard_Integer Curves2dDegree() const;
118   
119     const TColgp_Array1OfPnt2d& Curve2dPoles (const Standard_Integer Index) const;
120   
121     const TColStd_Array1OfReal& Curves2dKnots() const;
122   
123     const TColStd_Array1OfInteger& Curves2dMults() const;
124   
125     void TolReached (Standard_Real& Tol3d, Standard_Real& Tol2d) const;
126   
127   Standard_EXPORT Standard_Real TolCurveOnSurf (const Standard_Integer Index) const;
128
129
130
131
132 protected:
133
134
135
136
137
138 private:
139
140   
141   Standard_EXPORT void InternalPerform (const Handle(BRepBlend_Line)& Lin, Blend_AppFunction& SecGen, const Standard_Boolean SpApprox, const Standard_Boolean UseVariational);
142
143
144   Standard_Boolean done;
145   Standard_Integer dmin;
146   Standard_Integer dmax;
147   Standard_Real tol3d;
148   Standard_Real tol2d;
149   Standard_Integer nbit;
150   Standard_Integer udeg;
151   Standard_Integer vdeg;
152   Standard_Boolean knownp;
153   Handle(TColgp_HArray2OfPnt) tabPoles;
154   Handle(TColStd_HArray2OfReal) tabWeights;
155   Handle(TColStd_HArray1OfReal) tabUKnots;
156   Handle(TColStd_HArray1OfReal) tabVKnots;
157   Handle(TColStd_HArray1OfInteger) tabUMults;
158   Handle(TColStd_HArray1OfInteger) tabVMults;
159   TColgp_SequenceOfArray1OfPnt2d seqPoles2d;
160   Standard_Real tol3dreached;
161   Standard_Real tol2dreached;
162   Approx_ParametrizationType paramtype;
163   GeomAbs_Shape continuity;
164   Standard_Real critweights[3];
165
166
167 };
168
169 #define TheSectionGenerator Blend_AppFunction
170 #define TheSectionGenerator_hxx <Blend_AppFunction.hxx>
171 #define Handle_TheLine Handle(BRepBlend_Line)
172 #define TheLine BRepBlend_Line
173 #define TheLine_hxx <BRepBlend_Line.hxx>
174 #define AppBlend_AppSurf BRepBlend_AppSurf
175 #define AppBlend_AppSurf_hxx <BRepBlend_AppSurf.hxx>
176
177 #include <AppBlend_AppSurf.lxx>
178
179 #undef TheSectionGenerator
180 #undef TheSectionGenerator_hxx
181 #undef Handle_TheLine
182 #undef TheLine
183 #undef TheLine_hxx
184 #undef AppBlend_AppSurf
185 #undef AppBlend_AppSurf_hxx
186
187
188
189
190 #endif // _BRepBlend_AppSurf_HeaderFile