0025929: Make Approx_ComputeLine algorithm adaptive
[occt.git] / src / GeomInt / GeomInt_WLApprox.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-01-27
2// Created by: Jacques GOUSSARD
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 _GeomInt_WLApprox_HeaderFile
18#define _GeomInt_WLApprox_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
f44aa197 24#include <NCollection_Vector.hxx>
42cf5bc1 25#include <GeomInt_TheComputeLineOfWLApprox.hxx>
26#include <GeomInt_TheComputeLineBezierOfWLApprox.hxx>
27#include <Approx_MCurvesToBSpCurve.hxx>
28#include <Standard_Boolean.hxx>
29#include <Standard_Real.hxx>
30#include <Standard_Integer.hxx>
31#include <Approx_ParametrizationType.hxx>
32class Standard_OutOfRange;
33class StdFail_NotDone;
34class Adaptor3d_HSurface;
35class Adaptor3d_HSurfaceTool;
36class IntSurf_Quadric;
37class IntSurf_QuadricTool;
38class IntPatch_WLine;
39class GeomInt_ThePrmPrmSvSurfacesOfWLApprox;
40class GeomInt_TheInt2SOfThePrmPrmSvSurfacesOfWLApprox;
41class GeomInt_TheImpPrmSvSurfacesOfWLApprox;
42class GeomInt_TheZerImpFuncOfTheImpPrmSvSurfacesOfWLApprox;
43class GeomInt_TheMultiLineOfWLApprox;
44class GeomInt_TheMultiLineToolOfWLApprox;
45class GeomInt_TheComputeLineOfWLApprox;
46class GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox;
47class GeomInt_MyGradientbisOfTheComputeLineOfWLApprox;
48class GeomInt_TheComputeLineBezierOfWLApprox;
49class GeomInt_MyGradientOfTheComputeLineBezierOfWLApprox;
50class AppParCurves_MultiBSpCurve;
51
f44aa197 52struct Approx_Data
53{
54 Approx_Data()
55 {
56 myMinFactorXYZ = 0.0;
57 myMinFactorUV = 0.0;
58 }
59
60 Standard_Boolean myBezierApprox;
61 Standard_Real Xo, Ax, Yo, Ay, Zo, Az,
62 U1o, A1u, V1o, A1v, U2o, A2u, V2o, A2v;
63 Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2;
64 Standard_Integer indicemin, indicemax, nbpntmax;
65 Approx_ParametrizationType parametrization;
66 Standard_Real myMinFactorXYZ, myMinFactorUV;
67};
42cf5bc1 68
69
70class GeomInt_WLApprox
71{
72public:
73
74 DEFINE_STANDARD_ALLOC
75
76
77 Standard_EXPORT GeomInt_WLApprox();
78
79 Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Surf1, const Handle(Adaptor3d_HSurface)& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
80
81 Standard_EXPORT void Perform (const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
82
83 Standard_EXPORT void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Integer DegMin, const Standard_Integer DegMax, const Standard_Integer NbIterMax, const Standard_Boolean ApproxWithTangency = Standard_True, const Approx_ParametrizationType Parametrization = Approx_ChordLength);
84
85 Standard_EXPORT void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d, const Standard_Boolean RelativeTol, const Standard_Integer DegMin, const Standard_Integer DegMax, const Standard_Integer NbIterMax, const Standard_Integer NbPntMax, const Standard_Boolean ApproxWithTangency = Standard_True, const Approx_ParametrizationType Parametrization = Approx_ChordLength);
86
87 Standard_EXPORT void Perform();
88
89 Standard_EXPORT Standard_Real TolReached3d() const;
90
91 Standard_EXPORT Standard_Real TolReached2d() const;
92
93 Standard_EXPORT Standard_Boolean IsDone() const;
94
95 Standard_EXPORT Standard_Integer NbMultiCurves() const;
96
97 Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const;
98
99
100
101
102protected:
103
104
105
106
107
108private:
109
0cbfb9f1 110 Standard_EXPORT Standard_Integer CorrectFinishIdx(const Standard_Integer theMinIdx,
111 const Standard_Integer theMaxIdx,
112 const Handle(IntPatch_WLine)& theline);
113
42cf5bc1 114 Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Surf1, const IntSurf_Quadric& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax);
115
116 Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const Handle(Adaptor3d_HSurface)& Surf2, const Handle(IntPatch_WLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax);
117
118 Standard_EXPORT void UpdateTolReached();
119
f44aa197 120 //! Fill data structure for intersection approximation.
121 Standard_EXPORT void fillData(const Handle(IntPatch_WLine)& theLine,
122 const Standard_Boolean theApproxXYZ,
123 const Standard_Boolean theApproxU1V1,
124 const Standard_Boolean theApproxU2V2);
125
126 //! Prepare data structure for further computations.
127 Standard_EXPORT void prepareDS(const Standard_Boolean theApproxXYZ,
128 const Standard_Boolean theApproxU1V1,
129 const Standard_Boolean theApproxU2V2,
130 const Standard_Integer indicemin,
131 const Standard_Integer indicemax);
132
133 //! Build knot sequence.
134 Standard_EXPORT void buildKnots(const Handle(IntPatch_WLine)& theline,
135 const Standard_Address thePtrSVSurf);
136
137 //! Build curve.
138 Standard_EXPORT void buildCurve(const Handle(IntPatch_WLine)& theline,
139 const Standard_Address thePtrSVSurf);
42cf5bc1 140
141 GeomInt_TheComputeLineOfWLApprox myComputeLine;
142 GeomInt_TheComputeLineBezierOfWLApprox myComputeLineBezier;
143 Approx_MCurvesToBSpCurve myBezToBSpl;
144 Standard_Boolean myTolReached;
42cf5bc1 145 Standard_Boolean myWithTangency;
146 Standard_Real myTol3d;
147 Standard_Real myTol2d;
148 Standard_Boolean myRelativeTol;
149 Standard_Integer myDegMin;
150 Standard_Integer myDegMax;
151 Standard_Integer myNbPntMax;
152 Standard_Integer myNbIterMax;
42cf5bc1 153 Standard_Real myTolReached3d;
154 Standard_Real myTolReached2d;
f44aa197 155 Approx_Data myData;
156 Standard_Real myUVRes1, myUVRes2;
157 NCollection_Vector<Standard_Integer> myKnots;
42cf5bc1 158
159};
160
161
162
163
164
165
166
167#endif // _GeomInt_WLApprox_HeaderFile