0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakeFilling.hxx
CommitLineData
42cf5bc1 1// Created on: 1998-08-26
2// Created by: Julia GERASIMOVA
3// Copyright (c) 1998-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 _BRepOffsetAPI_MakeFilling_HeaderFile
18#define _BRepOffsetAPI_MakeFilling_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <BRepFill_Filling.hxx>
25#include <BRepBuilderAPI_MakeShape.hxx>
26#include <Standard_Integer.hxx>
27#include <Standard_Boolean.hxx>
28#include <Standard_Real.hxx>
29#include <GeomAbs_Shape.hxx>
30#include <TopTools_ListOfShape.hxx>
31class StdFail_NotDone;
32class Standard_OutOfRange;
33class Standard_ConstructionError;
34class TopoDS_Face;
35class TopoDS_Edge;
36class gp_Pnt;
37class TopoDS_Shape;
38
39
40//! N-Side Filling
41//! This algorithm avoids to build a face from:
42//! * a set of edges defining the bounds of the face and some
43//! constraints the surface of the face has to satisfy
44//! * a set of edges and points defining some constraints
45//! the support surface has to satisfy
46//! * an initial surface to deform for satisfying the constraints
47//! * a set of parameters to control the constraints.
48//!
49//! The support surface of the face is computed by deformation
50//! of the initial surface in order to satisfy the given constraints.
51//! The set of bounding edges defines the wire of the face.
52//!
53//! If no initial surface is given, the algorithm computes it
54//! automatically.
55//! If the set of edges is not connected (Free constraint)
56//! missing edges are automatically computed.
57//!
58//! Limitations:
59//! * If some constraints are not compatible
60//! The algorithm does not take them into account.
61//! So the constraints will not be satisfyed in an area containing
62//! the incompatibilitries.
63//! * The constraints defining the bound of the face have to be
64//! entered in order to have a continuous wire.
65//!
66//! Other Applications:
67//! * Deformation of a face to satisfy internal constraints
68//! * Deformation of a face to improve Gi continuity with
69//! connected faces
70class BRepOffsetAPI_MakeFilling : public BRepBuilderAPI_MakeShape
71{
72public:
73
74 DEFINE_STANDARD_ALLOC
75
76
77 //! Constructs a wire filling object defined by
78 //! - the energy minimizing criterion Degree
79 //! - the number of points on the curve NbPntsOnCur
80 //! - the number of iterations NbIter
81 //! - the Boolean Anisotropie
82 //! - the 2D tolerance Tol2d
83 //! - the 3D tolerance Tol3d
84 //! - the angular tolerance TolAng
85 //! - the tolerance for curvature TolCur
86 //! - the highest polynomial degree MaxDeg
87 //! - the greatest number of segments MaxSeg.
88 //! If the Boolean Anistropie is true, the algorithm's
89 //! performance is better in cases where the ratio of the
90 //! length U and the length V indicate a great difference
91 //! between the two. In other words, when the surface is, for
92 //! example, extremely long.
93 Standard_EXPORT BRepOffsetAPI_MakeFilling(const Standard_Integer Degree = 3, const Standard_Integer NbPtsOnCur = 15, const Standard_Integer NbIter = 2, const Standard_Boolean Anisotropie = Standard_False, const Standard_Real Tol2d = 0.00001, const Standard_Real Tol3d = 0.0001, const Standard_Real TolAng = 0.01, const Standard_Real TolCurv = 0.1, const Standard_Integer MaxDeg = 8, const Standard_Integer MaxSegments = 9);
94
95 //! Sets the values of Tolerances used to control the constraint.
96 //! Tol2d:
97 //! Tol3d: it is the maximum distance allowed between the support surface
98 //! and the constraints
99 //! TolAng: it is the maximum angle allowed between the normal of the surface
100 //! and the constraints
101 //! TolCurv: it is the maximum difference of curvature allowed between
102 //! the surface and the constraint
103 Standard_EXPORT void SetConstrParam (const Standard_Real Tol2d = 0.00001, const Standard_Real Tol3d = 0.0001, const Standard_Real TolAng = 0.01, const Standard_Real TolCurv = 0.1);
104
105 //! Sets the parameters used for resolution.
106 //! The default values of these parameters have been chosen for a good
107 //! ratio quality/performance.
108 //! Degree: it is the order of energy criterion to minimize for computing
109 //! the deformation of the surface.
110 //! The default value is 3
111 //! The recommanded value is i+2 where i is the maximum order of the
112 //! constraints.
113 //! NbPtsOnCur: it is the average number of points for discretisation
114 //! of the edges.
115 //! NbIter: it is the maximum number of iterations of the process.
116 //! For each iteration the number of discretisation points is
117 //! increased.
118 //! Anisotropie:
119 Standard_EXPORT void SetResolParam (const Standard_Integer Degree = 3, const Standard_Integer NbPtsOnCur = 15, const Standard_Integer NbIter = 2, const Standard_Boolean Anisotropie = Standard_False);
120
121 //! Sets the parameters used to approximate the filling
122 //! surface. These include:
123 //! - MaxDeg - the highest degree which the polynomial
124 //! defining the filling surface can have
125 //! - MaxSegments - the greatest number of segments
126 //! which the filling surface can have.
127 Standard_EXPORT void SetApproxParam (const Standard_Integer MaxDeg = 8, const Standard_Integer MaxSegments = 9);
128
129 //! Loads the initial surface Surf to
130 //! begin the construction of the surface.
131 //! This optional function is useful if the surface resulting from
132 //! construction for the algorithm is likely to be complex.
133 //! The support surface of the face under construction is computed by a
134 //! deformation of Surf which satisfies the given constraints.
135 //! The set of bounding edges defines the wire of the face.
136 //! If no initial surface is given, the algorithm computes it
137 //! automatically. If the set of edges is not connected (Free constraint),
138 //! missing edges are automatically computed.
139 //! Important: the initial surface must have orthogonal local coordinates,
140 //! i.e. partial derivatives dS/du and dS/dv must be orthogonal
141 //! at each point of surface.
142 //! If this condition breaks, distortions of resulting surface
143 //! are possible.
144 Standard_EXPORT void LoadInitSurface (const TopoDS_Face& Surf);
145
146 //! Adds a new constraint which also defines an edge of the wire
147 //! of the face
148 //! Order: Order of the constraint:
149 //! GeomAbs_C0 : the surface has to pass by 3D representation
150 //! of the edge
151 //! GeomAbs_G1 : the surface has to pass by 3D representation
152 //! of the edge and to respect tangency with the first
153 //! face of the edge
154 //! GeomAbs_G2 : the surface has to pass by 3D representation
155 //! of the edge and to respect tangency and curvature
156 //! with the first face of the edge.
157 //! Raises ConstructionError if the edge has no representation on a face and Order is
158 //! GeomAbs_G1 or GeomAbs_G2.
159 Standard_EXPORT Standard_Integer Add (const TopoDS_Edge& Constr, const GeomAbs_Shape Order, const Standard_Boolean IsBound = Standard_True);
160
161 //! Adds a new constraint which also defines an edge of the wire
162 //! of the face
163 //! Order: Order of the constraint:
164 //! GeomAbs_C0 : the surface has to pass by 3D representation
165 //! of the edge
166 //! GeomAbs_G1 : the surface has to pass by 3D representation
167 //! of the edge and to respect tangency with the
168 //! given face
169 //! GeomAbs_G2 : the surface has to pass by 3D representation
170 //! of the edge and to respect tangency and curvature
171 //! with the given face.
172 //! Raises ConstructionError if the edge has no 2d representation on the given face
173 Standard_EXPORT Standard_Integer Add (const TopoDS_Edge& Constr, const TopoDS_Face& Support, const GeomAbs_Shape Order, const Standard_Boolean IsBound = Standard_True);
174
175 //! Adds a free constraint on a face. The corresponding edge has to
176 //! be automatically recomputed. It is always a bound.
177 Standard_EXPORT Standard_Integer Add (const TopoDS_Face& Support, const GeomAbs_Shape Order);
178
179 //! Adds a punctual constraint.
180 Standard_EXPORT Standard_Integer Add (const gp_Pnt& Point);
181
182 //! Adds a punctual constraint.
183 Standard_EXPORT Standard_Integer Add (const Standard_Real U, const Standard_Real V, const TopoDS_Face& Support, const GeomAbs_Shape Order);
184
185 //! Builds the resulting faces
186 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
187
188 //! Tests whether computation of the filling plate has been completed.
189 Standard_EXPORT virtual Standard_Boolean IsDone() const Standard_OVERRIDE;
190
191 //! Returns the list of shapes generated from the
192 //! shape <S>.
193 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
194
195 //! Returns the maximum distance between the result and
196 //! the constraints. This is set at construction time.
197 Standard_EXPORT Standard_Real G0Error() const;
198
199 //! Returns the maximum angle between the result and the
200 //! constraints. This is set at construction time.
201 Standard_EXPORT Standard_Real G1Error() const;
202
203 //! Returns the maximum angle between the result and the
204 //! constraints. This is set at construction time.
205 Standard_EXPORT Standard_Real G2Error() const;
206
207 //! Returns the maximum distance attained between the
208 //! result and the constraint Index. This is set at construction time.
209 Standard_EXPORT Standard_Real G0Error (const Standard_Integer Index);
210
211 //! Returns the maximum angle between the result and the
212 //! constraints. This is set at construction time.
213 Standard_EXPORT Standard_Real G1Error (const Standard_Integer Index);
214
215 //! Returns the greatest difference in curvature found
216 //! between the result and the constraint Index.
217 Standard_EXPORT Standard_Real G2Error (const Standard_Integer Index);
218
219
220
221
222protected:
223
224
225
226
227
228private:
229
230
231
232 BRepFill_Filling myFilling;
233
234
235};
236
237
238
239
240
241
242
243#endif // _BRepOffsetAPI_MakeFilling_HeaderFile