0026431: Can't cut a sphere from a cylinder
[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{
4e14c88f 54 Approx_Data() : myBezierApprox(Standard_True),
55 Xo(0.0), Yo(0.0), Zo(0.0),
56 U1o(0.0), V1o(0.0), U2o(0.0), V2o(0.0),
57 ApproxXYZ(Standard_True),
58 ApproxU1V1(Standard_True),
59 ApproxU2V2(Standard_True),
60 indicemin(0), indicemax(0),
61 myNbPntMax(30), parametrization(Approx_ChordLength)
f44aa197 62 {
f44aa197 63 }
64
65 Standard_Boolean myBezierApprox;
4e14c88f 66 Standard_Real Xo, Yo, Zo, U1o, V1o, U2o, V2o;
f44aa197 67 Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2;
4e14c88f 68 Standard_Integer indicemin, indicemax, myNbPntMax;
f44aa197 69 Approx_ParametrizationType parametrization;
f44aa197 70};
42cf5bc1 71
72
73class GeomInt_WLApprox
74{
75public:
76
77 DEFINE_STANDARD_ALLOC
78
79
80 Standard_EXPORT GeomInt_WLApprox();
81
82 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);
83
84 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);
85
4e14c88f 86 Standard_EXPORT
87 void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d,
88 const Standard_Integer DegMin,
89 const Standard_Integer DegMax,
90 const Standard_Integer NbIterMax,
91 const Standard_Integer NbPntMax = 30,
92 const Standard_Boolean ApproxWithTangency = Standard_True,
93 const Approx_ParametrizationType
94 Parametrization = Approx_ChordLength);
42cf5bc1 95 Standard_EXPORT void Perform();
96
97 Standard_EXPORT Standard_Real TolReached3d() const;
98
99 Standard_EXPORT Standard_Real TolReached2d() const;
100
101 Standard_EXPORT Standard_Boolean IsDone() const;
102
103 Standard_EXPORT Standard_Integer NbMultiCurves() const;
104
105 Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const;
106
107
108
109
110protected:
111
112
113
114
115
116private:
4e14c88f 117 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, const Standard_Boolean isTheQuadFirst);
42cf5bc1 118
119 Standard_EXPORT void UpdateTolReached();
120
f44aa197 121 //! Fill data structure for intersection approximation.
4e14c88f 122 Standard_EXPORT void fillData(const Handle(IntPatch_WLine)& theLine);
f44aa197 123
124 //! Prepare data structure for further computations.
125 Standard_EXPORT void prepareDS(const Standard_Boolean theApproxXYZ,
126 const Standard_Boolean theApproxU1V1,
127 const Standard_Boolean theApproxU2V2,
128 const Standard_Integer indicemin,
129 const Standard_Integer indicemax);
130
131 //! Build knot sequence.
132 Standard_EXPORT void buildKnots(const Handle(IntPatch_WLine)& theline,
133 const Standard_Address thePtrSVSurf);
134
135 //! Build curve.
136 Standard_EXPORT void buildCurve(const Handle(IntPatch_WLine)& theline,
137 const Standard_Address thePtrSVSurf);
42cf5bc1 138
139 GeomInt_TheComputeLineOfWLApprox myComputeLine;
140 GeomInt_TheComputeLineBezierOfWLApprox myComputeLineBezier;
141 Approx_MCurvesToBSpCurve myBezToBSpl;
42cf5bc1 142 Standard_Boolean myWithTangency;
143 Standard_Real myTol3d;
144 Standard_Real myTol2d;
42cf5bc1 145 Standard_Integer myDegMin;
146 Standard_Integer myDegMax;
42cf5bc1 147 Standard_Integer myNbIterMax;
42cf5bc1 148 Standard_Real myTolReached3d;
149 Standard_Real myTolReached2d;
f44aa197 150 Approx_Data myData;
f44aa197 151 NCollection_Vector<Standard_Integer> myKnots;
42cf5bc1 152
153};
154
155
156
157
158
159
160
161#endif // _GeomInt_WLApprox_HeaderFile