42cf5bc1 |
1 | // Created on: 1995-06-06 |
2 | // Created by: Jean Yves LEBEY |
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 _BRepApprox_Approx_HeaderFile |
18 | #define _BRepApprox_Approx_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 <BRepApprox_TheComputeLineOfApprox.hxx> |
26 | #include <BRepApprox_TheComputeLineBezierOfApprox.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> |
32 | class Standard_OutOfRange; |
33 | class StdFail_NotDone; |
34 | class BRepAdaptor_Surface; |
35 | class BRepApprox_SurfaceTool; |
36 | class IntSurf_Quadric; |
37 | class IntSurf_QuadricTool; |
38 | class BRepApprox_ApproxLine; |
39 | class BRepApprox_ThePrmPrmSvSurfacesOfApprox; |
40 | class BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox; |
41 | class BRepApprox_TheImpPrmSvSurfacesOfApprox; |
42 | class BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox; |
43 | class BRepApprox_TheMultiLineOfApprox; |
44 | class BRepApprox_TheMultiLineToolOfApprox; |
45 | class BRepApprox_TheComputeLineOfApprox; |
46 | class BRepApprox_MyBSplGradientOfTheComputeLineOfApprox; |
47 | class BRepApprox_MyGradientbisOfTheComputeLineOfApprox; |
48 | class BRepApprox_TheComputeLineBezierOfApprox; |
49 | class BRepApprox_MyGradientOfTheComputeLineBezierOfApprox; |
50 | class AppParCurves_MultiBSpCurve; |
51 | |
68df8478 |
52 | class BRepApprox_Approx |
f44aa197 |
53 | { |
68df8478 |
54 | private: |
55 | struct Approx_Data |
f44aa197 |
56 | { |
68df8478 |
57 | Approx_Data () : myBezierApprox (Standard_True), |
58 | Xo (0.0), Yo (0.0), Zo (0.0), |
59 | U1o (0.0), V1o (0.0), U2o (0.0), V2o (0.0), |
60 | ApproxXYZ (Standard_True), |
61 | ApproxU1V1 (Standard_True), |
62 | ApproxU2V2 (Standard_True), |
63 | indicemin (0), indicemax (0), |
64 | myNbPntMax (30), parametrization (Approx_ChordLength) |
65 | { |
66 | } |
67 | |
68 | Standard_Boolean myBezierApprox; |
69 | Standard_Real Xo, Yo, Zo, U1o, V1o, U2o, V2o; |
70 | Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2; |
71 | Standard_Integer indicemin, indicemax, myNbPntMax; |
72 | Approx_ParametrizationType parametrization; |
73 | }; |
f44aa197 |
74 | |
42cf5bc1 |
75 | |
42cf5bc1 |
76 | public: |
77 | |
78 | DEFINE_STANDARD_ALLOC |
79 | |
80 | |
81 | Standard_EXPORT BRepApprox_Approx(); |
82 | |
83 | Standard_EXPORT void Perform (const BRepAdaptor_Surface& Surf1, const BRepAdaptor_Surface& Surf2, const Handle(BRepApprox_ApproxLine)& 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); |
84 | |
85 | Standard_EXPORT void Perform (const Handle(BRepApprox_ApproxLine)& 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); |
86 | |
4e14c88f |
87 | Standard_EXPORT |
88 | void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d, |
89 | const Standard_Integer DegMin, |
90 | const Standard_Integer DegMax, |
91 | const Standard_Integer NbIterMax, |
92 | const Standard_Integer NbPntMax = 30, |
93 | const Standard_Boolean ApproxWithTangency = Standard_True, |
94 | const Approx_ParametrizationType |
95 | Parametrization = Approx_ChordLength); |
96 | |
42cf5bc1 |
97 | Standard_EXPORT void Perform(); |
98 | |
99 | Standard_EXPORT Standard_Real TolReached3d() const; |
100 | |
101 | Standard_EXPORT Standard_Real TolReached2d() const; |
102 | |
103 | Standard_EXPORT Standard_Boolean IsDone() const; |
104 | |
105 | Standard_EXPORT Standard_Integer NbMultiCurves() const; |
106 | |
107 | Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const; |
108 | |
109 | |
110 | |
111 | |
112 | protected: |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | private: |
4e14c88f |
119 | Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const BRepAdaptor_Surface& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax, const Standard_Boolean isTheQuadFirst); |
42cf5bc1 |
120 | |
121 | Standard_EXPORT void UpdateTolReached(); |
122 | |
f44aa197 |
123 | //! Fill data structure for intersection approximation. |
4e14c88f |
124 | Standard_EXPORT void fillData(const Handle(BRepApprox_ApproxLine)& theLine); |
f44aa197 |
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(BRepApprox_ApproxLine)& theline, |
135 | const Standard_Address thePtrSVSurf); |
136 | |
137 | //! Build curve. |
138 | Standard_EXPORT void buildCurve(const Handle(BRepApprox_ApproxLine)& theline, |
139 | const Standard_Address thePtrSVSurf); |
42cf5bc1 |
140 | |
141 | BRepApprox_TheComputeLineOfApprox myComputeLine; |
142 | BRepApprox_TheComputeLineBezierOfApprox myComputeLineBezier; |
143 | Approx_MCurvesToBSpCurve myBezToBSpl; |
42cf5bc1 |
144 | Standard_Boolean myWithTangency; |
145 | Standard_Real myTol3d; |
146 | Standard_Real myTol2d; |
42cf5bc1 |
147 | Standard_Integer myDegMin; |
148 | Standard_Integer myDegMax; |
42cf5bc1 |
149 | Standard_Integer myNbIterMax; |
42cf5bc1 |
150 | Standard_Real myTolReached3d; |
151 | Standard_Real myTolReached2d; |
f44aa197 |
152 | Approx_Data myData; |
f44aa197 |
153 | NCollection_Vector<Standard_Integer> myKnots; |
42cf5bc1 |
154 | |
155 | }; |
156 | |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | #endif // _BRepApprox_Approx_HeaderFile |