0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / Approx / Approx_SweepApproximation.hxx
CommitLineData
42cf5bc1 1// Created on: 1997-06-24
2// Created by: Philippe MANGIN
3// Copyright (c) 1997-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 _Approx_SweepApproximation_HeaderFile
18#define _Approx_SweepApproximation_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 <TColgp_HArray2OfPnt.hxx>
27#include <TColStd_HArray2OfReal.hxx>
28#include <TColStd_HArray1OfReal.hxx>
29#include <TColStd_HArray1OfInteger.hxx>
30#include <TColgp_SequenceOfArray1OfPnt2d.hxx>
31#include <Approx_HArray1OfGTrsf2d.hxx>
32#include <gp_Vec.hxx>
33#include <TColgp_HArray1OfPnt.hxx>
34#include <TColgp_HArray1OfPnt2d.hxx>
35#include <TColgp_HArray1OfVec.hxx>
36#include <TColgp_HArray1OfVec2d.hxx>
37#include <Standard_Real.hxx>
38#include <GeomAbs_Shape.hxx>
39#include <AdvApprox_EvaluatorFunction.hxx>
40#include <TColgp_Array2OfPnt.hxx>
41#include <TColStd_Array2OfReal.hxx>
42#include <TColStd_Array1OfReal.hxx>
43#include <TColStd_Array1OfInteger.hxx>
44#include <TColgp_Array1OfPnt2d.hxx>
45#include <Standard_OStream.hxx>
46class Approx_SweepFunction;
47class StdFail_NotDone;
48class Standard_DomainError;
49class Standard_OutOfRange;
50class AdvApprox_Cutting;
51
52
53//! Approximation of an Surface S(u,v)
54//! (and eventually associate 2d Curves) defined
55//! by section's law.
56//!
57//! This surface is defined by a function F(u, v)
58//! where Ft(u) = F(u, t) is a bspline curve.
59//! To use this algorithme, you have to implement Ft(u)
60//! as a derivative class of Approx_SweepFunction.
61//! This algorithm can be used by blending, sweeping...
62class Approx_SweepApproximation
63{
64public:
65
66 DEFINE_STANDARD_ALLOC
67
68
69 Standard_EXPORT Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func);
70
71 //! Perform the Approximation
72 //! [First, Last] : Approx_SweepApproximation.cdl
73 //! Tol3d : Tolerance to surface approximation
74 //! Tol2d : Tolerance used to perform curve approximation
75 //! Normaly the 2d curve are approximated with a
76 //! tolerance given by the resolution on support surfaces,
77 //! but if this tolerance is too large Tol2d is used.
78 //! TolAngular : Tolerance (in radian) to control the angle
79 //! beetween tangents on the section law and
80 //! tangent of iso-v on approximed surface
81 //! Continuity : The continuity in v waiting on the surface
82 //! Degmax : The maximum degree in v requiered on the surface
83 //! Segmax : The maximum number of span in v requiered on
84 //! the surface
85 //! Warning : The continuity ci can be obtained only if Ft is Ci
86 Standard_EXPORT void Perform (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol3d, const Standard_Real BoundTol, const Standard_Real Tol2d, const Standard_Real TolAngular, const GeomAbs_Shape Continuity = GeomAbs_C0, const Standard_Integer Degmax = 11, const Standard_Integer Segmax = 50);
87
88 //! The EvaluatorFunction from AdvApprox;
89 Standard_EXPORT Standard_Integer Eval (const Standard_Real Parameter, const Standard_Integer DerivativeRequest, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
90
91 //! returns if we have an result
92 Standard_Boolean IsDone() const;
93
94 Standard_EXPORT void SurfShape (Standard_Integer& UDegree, Standard_Integer& VDegree, Standard_Integer& NbUPoles, Standard_Integer& NbVPoles, Standard_Integer& NbUKnots, Standard_Integer& NbVKnots) const;
95
96 Standard_EXPORT void Surface (TColgp_Array2OfPnt& TPoles, TColStd_Array2OfReal& TWeights, TColStd_Array1OfReal& TUKnots, TColStd_Array1OfReal& TVKnots, TColStd_Array1OfInteger& TUMults, TColStd_Array1OfInteger& TVMults) const;
97
98 Standard_Integer UDegree() const;
99
100 Standard_Integer VDegree() const;
101
102 const TColgp_Array2OfPnt& SurfPoles() const;
103
104 const TColStd_Array2OfReal& SurfWeights() const;
105
106 const TColStd_Array1OfReal& SurfUKnots() const;
107
108 const TColStd_Array1OfReal& SurfVKnots() const;
109
110 const TColStd_Array1OfInteger& SurfUMults() const;
111
112 const TColStd_Array1OfInteger& SurfVMults() const;
113
114 //! returns the maximum error in the suface approximation.
115 Standard_EXPORT Standard_Real MaxErrorOnSurf() const;
116
117 //! returns the average error in the suface approximation.
118 Standard_EXPORT Standard_Real AverageErrorOnSurf() const;
119
120 Standard_Integer NbCurves2d() const;
121
122 Standard_EXPORT void Curves2dShape (Standard_Integer& Degree, Standard_Integer& NbPoles, Standard_Integer& NbKnots) const;
123
124 Standard_EXPORT void Curve2d (const Standard_Integer Index, TColgp_Array1OfPnt2d& TPoles, TColStd_Array1OfReal& TKnots, TColStd_Array1OfInteger& TMults) const;
125
126 Standard_Integer Curves2dDegree() const;
127
128 const TColgp_Array1OfPnt2d& Curve2dPoles (const Standard_Integer Index) const;
129
130 const TColStd_Array1OfReal& Curves2dKnots() const;
131
132 const TColStd_Array1OfInteger& Curves2dMults() const;
133
134 //! returns the maximum error of the <Index>
135 //! 2d curve approximation.
136 Standard_EXPORT Standard_Real Max2dError (const Standard_Integer Index) const;
137
138 //! returns the average error of the <Index>
139 //! 2d curve approximation.
140 Standard_EXPORT Standard_Real Average2dError (const Standard_Integer Index) const;
141
142 //! returns the maximum 3d error of the <Index>
143 //! 2d curve approximation on the Surface.
144 Standard_EXPORT Standard_Real TolCurveOnSurf (const Standard_Integer Index) const;
145
146 //! display information on approximation.
147 Standard_EXPORT void Dump (Standard_OStream& o) const;
148
149
150
151
152protected:
153
154
155
156
157
158private:
159
160
161 Standard_EXPORT void Approximation (const Handle(TColStd_HArray1OfReal)& OneDTol, const Handle(TColStd_HArray1OfReal)& TwoDTol, const Handle(TColStd_HArray1OfReal)& ThreeDTol, const Standard_Real BounTol, const Standard_Real First, const Standard_Real Last, const GeomAbs_Shape Continuity, const Standard_Integer Degmax, const Standard_Integer Segmax, const AdvApprox_EvaluatorFunction& TheApproxFunction, const AdvApprox_Cutting& TheCuttingTool);
162
163 Standard_EXPORT Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
164
165 Standard_EXPORT Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
166
167 Standard_EXPORT Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
168
169
170 Handle(Approx_SweepFunction) myFunc;
171 Standard_Boolean done;
172 Standard_Integer Num1DSS;
173 Standard_Integer Num2DSS;
174 Standard_Integer Num3DSS;
175 Standard_Integer udeg;
176 Standard_Integer vdeg;
177 Standard_Integer deg2d;
178 Handle(TColgp_HArray2OfPnt) tabPoles;
179 Handle(TColStd_HArray2OfReal) tabWeights;
180 Handle(TColStd_HArray1OfReal) tabUKnots;
181 Handle(TColStd_HArray1OfReal) tabVKnots;
182 Handle(TColStd_HArray1OfReal) tab2dKnots;
183 Handle(TColStd_HArray1OfInteger) tabUMults;
184 Handle(TColStd_HArray1OfInteger) tabVMults;
185 Handle(TColStd_HArray1OfInteger) tab2dMults;
186 TColgp_SequenceOfArray1OfPnt2d seqPoles2d;
187 Handle(TColStd_HArray1OfReal) MError1d;
188 Handle(TColStd_HArray1OfReal) tab2dError;
189 Handle(TColStd_HArray1OfReal) MError3d;
190 Handle(TColStd_HArray1OfReal) AError1d;
191 Handle(TColStd_HArray1OfReal) Ave2dError;
192 Handle(TColStd_HArray1OfReal) AError3d;
193 Handle(Approx_HArray1OfGTrsf2d) AAffin;
194 Handle(TColStd_HArray1OfReal) COnSurfErr;
195 gp_Vec Translation;
196 Handle(TColgp_HArray1OfPnt) myPoles;
197 Handle(TColgp_HArray1OfPnt2d) myPoles2d;
198 Handle(TColStd_HArray1OfReal) myWeigths;
199 Handle(TColgp_HArray1OfVec) myDPoles;
200 Handle(TColgp_HArray1OfVec) myD2Poles;
201 Handle(TColgp_HArray1OfVec2d) myDPoles2d;
202 Handle(TColgp_HArray1OfVec2d) myD2Poles2d;
203 Handle(TColStd_HArray1OfReal) myDWeigths;
204 Handle(TColStd_HArray1OfReal) myD2Weigths;
205 Standard_Integer myOrder;
206 Standard_Real myParam;
207 Standard_Real first;
208 Standard_Real last;
209
210
211};
212
213
214#include <Approx_SweepApproximation.lxx>
215
216
217
218
219
220#endif // _Approx_SweepApproximation_HeaderFile