0031464: BRepOffsetAPI_MakeFilling algorithm increases tolerances of vertices in...
[occt.git] / src / BRepFill / BRepFill_Filling.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 _BRepFill_Filling_HeaderFile
18#define _BRepFill_Filling_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <GeomPlate_BuildPlateSurface.hxx>
25#include <BRepFill_SequenceOfEdgeFaceAndOrder.hxx>
26#include <BRepFill_SequenceOfFaceAndOrder.hxx>
27#include <GeomPlate_SequenceOfPointConstraint.hxx>
9171cefa 28#include <TopTools_DataMapOfShapeShape.hxx>
42cf5bc1 29#include <TopTools_ListOfShape.hxx>
30#include <TopoDS_Face.hxx>
31#include <Standard_Real.hxx>
32#include <Standard_Integer.hxx>
33#include <Standard_Boolean.hxx>
34#include <GeomAbs_Shape.hxx>
35#include <TopTools_SequenceOfShape.hxx>
36class StdFail_NotDone;
37class Standard_OutOfRange;
38class Standard_ConstructionError;
39class TopoDS_Face;
40class TopoDS_Edge;
41class gp_Pnt;
42class TopoDS_Shape;
43
44
45//! N-Side Filling
46//! This algorithm avoids to build a face from:
47//! * a set of edges defining the bounds of the face and some
48//! constraints the surface support has to satisfy
49//! * a set of edges and points defining some constraints
50//! the support surface has to satisfy
51//! * an initial surface to deform for satisfying the constraints
52//! * a set of parameters to control the constraints.
53//!
54//! The support surface of the face is computed by deformation
55//! of the initial surface in order to satisfy the given constraints.
56//! The set of bounding edges defines the wire of the face.
57//!
58//! If no initial surface is given, the algorithm computes it
59//! automatically.
60//! If the set of edges is not connected (Free constraint)
61//! missing edges are automatically computed.
62//!
63//! Limitations:
64//! * If some constraints are not compatible
65//! The algorithm does not take them into account.
66//! So the constraints will not be satisfyed in an area containing
67//! the incompatibilitries.
68//! * The constraints defining the bound of the face have to be
69//! entered in order to have a continuous wire.
70//!
71//! Other Applications:
72//! * Deformation of a face to satisfy internal constraints
73//! * Deformation of a face to improve Gi continuity with
74//! connected faces
75class BRepFill_Filling
76{
77public:
78
79 DEFINE_STANDARD_ALLOC
80
81
82 //! Constructor
83 Standard_EXPORT BRepFill_Filling(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);
84
85 //! Sets the values of Tolerances used to control the constraint.
86 //! Tol2d:
87 //! Tol3d: it is the maximum distance allowed between the support surface
88 //! and the constraints
89 //! TolAng: it is the maximum angle allowed between the normal of the surface
90 //! and the constraints
91 //! TolCurv: it is the maximum difference of curvature allowed between
92 //! the surface and the constraint
93 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);
94
95 //! Sets the parameters used for resolution.
96 //! The default values of these parameters have been chosen for a good
97 //! ratio quality/performance.
98 //! Degree: it is the order of energy criterion to minimize for computing
99 //! the deformation of the surface.
100 //! The default value is 3
101 //! The recommanded value is i+2 where i is the maximum order of the
102 //! constraints.
103 //! NbPtsOnCur: it is the average number of points for discretisation
104 //! of the edges.
105 //! NbIter: it is the maximum number of iterations of the process.
106 //! For each iteration the number of discretisation points is
107 //! increased.
108 //! Anisotropie:
109 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);
110
111 //! Sets the parameters used for approximation of the surface
112 Standard_EXPORT void SetApproxParam (const Standard_Integer MaxDeg = 8, const Standard_Integer MaxSegments = 9);
113
114 //! Loads the initial Surface
115 //! The initial surface must have orthogonal local coordinates,
116 //! i.e. partial derivatives dS/du and dS/dv must be orthogonal
117 //! at each point of surface.
118 //! If this condition breaks, distortions of resulting surface
119 //! are possible.
120 Standard_EXPORT void LoadInitSurface (const TopoDS_Face& aFace);
121
122 //! Adds a new constraint which also defines an edge of the wire
123 //! of the face
124 //! Order: Order of the constraint:
125 //! GeomAbs_C0 : the surface has to pass by 3D representation
126 //! of the edge
127 //! GeomAbs_G1 : the surface has to pass by 3D representation
128 //! of the edge and to respect tangency with the first
129 //! face of the edge
130 //! GeomAbs_G2 : the surface has to pass by 3D representation
131 //! of the edge and to respect tangency and curvature
132 //! with the first face of the edge.
133 Standard_EXPORT Standard_Integer Add (const TopoDS_Edge& anEdge, const GeomAbs_Shape Order, const Standard_Boolean IsBound = Standard_True);
134
135 //! Adds a new constraint which also defines an edge of the wire
136 //! of the face
137 //! Order: Order of the constraint:
138 //! GeomAbs_C0 : the surface has to pass by 3D representation
139 //! of the edge
140 //! GeomAbs_G1 : the surface has to pass by 3D representation
141 //! of the edge and to respect tangency with the
142 //! given face
143 //! GeomAbs_G2 : the surface has to pass by 3D representation
144 //! of the edge and to respect tangency and curvature
145 //! with the given face.
146 Standard_EXPORT Standard_Integer Add (const TopoDS_Edge& anEdge, const TopoDS_Face& Support, const GeomAbs_Shape Order, const Standard_Boolean IsBound = Standard_True);
147
148 //! Adds a free constraint on a face. The corresponding edge has to
149 //! be automatically recomputed.
150 //! It is always a bound.
151 Standard_EXPORT Standard_Integer Add (const TopoDS_Face& Support, const GeomAbs_Shape Order);
152
153 //! Adds a punctual constraint
154 Standard_EXPORT Standard_Integer Add (const gp_Pnt& Point);
155
156 //! Adds a punctual constraint.
157 Standard_EXPORT Standard_Integer Add (const Standard_Real U, const Standard_Real V, const TopoDS_Face& Support, const GeomAbs_Shape Order);
158
159 //! Builds the resulting faces
160 Standard_EXPORT void Build();
161
162 Standard_EXPORT Standard_Boolean IsDone() const;
163
164 Standard_EXPORT TopoDS_Face Face() const;
165
166 //! Returns the list of shapes generated from the
167 //! shape <S>.
168 Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& S);
169
170 Standard_EXPORT Standard_Real G0Error() const;
171
172 Standard_EXPORT Standard_Real G1Error() const;
173
174 Standard_EXPORT Standard_Real G2Error() const;
175
176 Standard_EXPORT Standard_Real G0Error (const Standard_Integer Index);
177
178 Standard_EXPORT Standard_Real G1Error (const Standard_Integer Index);
179
180 Standard_EXPORT Standard_Real G2Error (const Standard_Integer Index);
181
182
183
184
185protected:
186
187
188
189
190
191private:
192
193
194 //! Adds constraints to builder
195 Standard_EXPORT void AddConstraints (const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints);
196
197 //! Builds wires of maximum length
198 Standard_EXPORT void BuildWires (TopTools_ListOfShape& EdgeList, TopTools_ListOfShape& WireList);
199
200 //! Finds extremities of future edges to fix the holes between wires.
201 //! Can properly operate only with convex contour
202 Standard_EXPORT void FindExtremitiesOfHoles (const TopTools_ListOfShape& WireList, TopTools_SequenceOfShape& VerSeq) const;
203
204
205 GeomPlate_BuildPlateSurface myBuilder;
206 BRepFill_SequenceOfEdgeFaceAndOrder myBoundary;
207 BRepFill_SequenceOfEdgeFaceAndOrder myConstraints;
208 BRepFill_SequenceOfFaceAndOrder myFreeConstraints;
209 GeomPlate_SequenceOfPointConstraint myPoints;
9171cefa 210 TopTools_DataMapOfShapeShape myOldNewMap;
42cf5bc1 211 TopTools_ListOfShape myGenerated;
212 TopoDS_Face myFace;
213 TopoDS_Face myInitFace;
214 Standard_Real myTol2d;
215 Standard_Real myTol3d;
216 Standard_Real myTolAng;
217 Standard_Real myTolCurv;
218 Standard_Integer myMaxDeg;
219 Standard_Integer myMaxSegments;
220 Standard_Integer myDegree;
221 Standard_Integer myNbPtsOnCur;
222 Standard_Integer myNbIter;
223 Standard_Boolean myAnisotropie;
224 Standard_Boolean myIsInitFaceGiven;
225 Standard_Boolean myIsDone;
226
227
228};
229
230
231
232
233
234
235
236#endif // _BRepFill_Filling_HeaderFile