1 -- Created on: 1998-08-26
2 -- Created by: Julia GERASIMOVA
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 class Filling from BRepFill
25 ---Purpose: N-Side Filling
26 -- This algorithm avoids to build a face from:
27 -- * a set of edges defining the bounds of the face and some
28 -- constraints the surface support has to satisfy
29 -- * a set of edges and points defining some constraints
30 -- the support surface has to satisfy
31 -- * an initial surface to deform for satisfying the constraints
32 -- * a set of parameters to control the constraints.
34 -- The support surface of the face is computed by deformation
35 -- of the initial surface in order to satisfy the given constraints.
36 -- The set of bounding edges defines the wire of the face.
38 -- If no initial surface is given, the algorithm computes it
40 -- If the set of edges is not connected (Free constraint)
41 -- missing edges are automatically computed.
44 -- * If some constraints are not compatible
45 -- The algorithm does not take them into account.
46 -- So the constraints will not be satisfyed in an area containing
47 -- the incompatibilitries.
48 -- * The constraints defining the bound of the face have to be
49 -- entered in order to have a continuous wire.
51 -- Other Applications:
52 -- * Deformation of a face to satisfy internal constraints
53 -- * Deformation of a face to improve Gi continuity with
64 BuildPlateSurface from GeomPlate,
65 SequenceOfEdgeFaceAndOrder from BRepFill,
66 SequenceOfFaceAndOrder from BRepFill,
67 SequenceOfPointConstraint from GeomPlate,
68 SequenceOfShape from TopTools,
69 ListOfShape from TopTools,
70 DataMapOfShapeListOfShape from TopTools,
71 SequenceOfPnt from TColgp
79 Create( Degree : Integer from Standard = 3;
80 NbPtsOnCur : Integer from Standard = 15;
81 NbIter : Integer from Standard = 2;
82 Anisotropie : Boolean from Standard = Standard_False;
83 Tol2d : Real from Standard = 0.00001;
84 Tol3d : Real from Standard = 0.0001;
85 TolAng : Real from Standard = 0.01;
86 TolCurv : Real from Standard = 0.1;
87 MaxDeg : Integer from Standard = 8;
88 MaxSegments : Integer from Standard = 9 )
89 ---Purpose: Constructor
91 returns Filling from BRepFill;
94 SetConstrParam( me : in out; Tol2d : Real from Standard = 0.00001;
95 Tol3d : Real from Standard = 0.0001;
96 TolAng : Real from Standard = 0.01;
97 TolCurv : Real from Standard = 0.1 );
98 ---Purpose: Sets the values of Tolerances used to control the constraint.
100 -- Tol3d: it is the maximum distance allowed between the support surface
101 -- and the constraints
102 -- TolAng: it is the maximum angle allowed between the normal of the surface
103 -- and the constraints
104 -- TolCurv: it is the maximum difference of curvature allowed between
105 -- the surface and the constraint
107 SetResolParam( me : in out; Degree : Integer from Standard = 3;
108 NbPtsOnCur : Integer from Standard = 15;
109 NbIter : Integer from Standard = 2;
110 Anisotropie : Boolean from Standard = Standard_False );
111 ---Purpose: Sets the parameters used for resolution.
112 -- The default values of these parameters have been chosen for a good
113 -- ratio quality/performance.
114 -- Degree: it is the order of energy criterion to minimize for computing
115 -- the deformation of the surface.
116 -- The default value is 3
117 -- The recommanded value is i+2 where i is the maximum order of the
119 -- NbPtsOnCur: it is the average number of points for discretisation
121 -- NbIter: it is the maximum number of iterations of the process.
122 -- For each iteration the number of discretisation points is
126 SetApproxParam( me : in out; MaxDeg : Integer from Standard = 8;
127 MaxSegments : Integer from Standard = 9 );
128 ---Purpose: Sets the parameters used for approximation of the surface
132 LoadInitSurface( me : in out; aFace : Face from TopoDS );
133 ---Purpose: Loads the initial Surface
136 Add( me : in out; anEdge : Edge from TopoDS;
137 Order : Shape from GeomAbs;
138 IsBound : Boolean from Standard = Standard_True )
139 returns Integer from Standard
140 ---Purpose: Adds a new constraint which also defines an edge of the wire
142 -- Order: Order of the constraint:
143 -- GeomAbs_C0 : the surface has to pass by 3D representation
145 -- GeomAbs_G1 : the surface has to pass by 3D representation
146 -- of the edge and to respect tangency with the first
148 -- GeomAbs_G2 : the surface has to pass by 3D representation
149 -- of the edge and to respect tangency and curvature
150 -- with the first face of the edge.
151 raises ConstructionError from Standard;
152 -- if the edge has no representation on a face and Order is
153 -- GeomAbs_G1 or GeomAbs_G2.
155 Add( me : in out; anEdge : Edge from TopoDS;
156 Support : Face from TopoDS;
157 Order : Shape from GeomAbs;
158 IsBound : Boolean from Standard = Standard_True )
159 returns Integer from Standard
160 ---Purpose: Adds a new constraint which also defines an edge of the wire
162 -- Order: Order of the constraint:
163 -- GeomAbs_C0 : the surface has to pass by 3D representation
165 -- GeomAbs_G1 : the surface has to pass by 3D representation
166 -- of the edge and to respect tangency with the
168 -- GeomAbs_G2 : the surface has to pass by 3D representation
169 -- of the edge and to respect tangency and curvature
170 -- with the given face.
171 raises ConstructionError from Standard;
172 -- if the edge has no 2d representation on the given face
174 Add( me : in out; Support : Face from TopoDS;
175 Order : Shape from GeomAbs )
176 returns Integer from Standard;
177 ---Purpose: Adds a free constraint on a face. The corresponding edge has to
178 -- be automatically recomputed.
179 -- It is always a bound.
181 Add( me : in out; Point : Pnt from gp )
182 returns Integer from Standard;
183 ---Purpose: Adds a punctual constraint
185 Add( me : in out; U, V : Real from Standard;
186 Support : Face from TopoDS;
187 Order : Shape from GeomAbs )
188 returns Integer from Standard;
189 ---Purpose: Adds a punctual constraint.
192 AddConstraints( me : in out; SeqOfConstraints : SequenceOfEdgeFaceAndOrder from BRepFill )
193 ---Purpose: Adds constraints to builder
196 BuildWires( me : in out; EdgeList : in out ListOfShape from TopTools;
197 WireList : out ListOfShape from TopTools )
198 ---Purpose: Builds wires of maximum length
201 FindExtremitiesOfHoles( me; WireList : ListOfShape from TopTools;
202 VerSeq : out SequenceOfShape from TopTools )
203 ---Purpose: Finds extremities of future edges to fix the holes between wires.
204 -- Can properly operate only with convex contour
207 Build( me : in out );
208 ---Purpose: Builds the resulting faces
210 IsDone(me) returns Boolean from Standard;
212 Face(me) returns Face from TopoDS;
213 -- returns the resulting face
215 Generated (me: in out; S : Shape from TopoDS)
216 ---Purpose: Returns the list of shapes generated from the
218 ---C++: return const &
220 returns ListOfShape from TopTools;
222 G0Error(me) returns Real from Standard;
223 -- returns the max distance between the result and the constraints
225 G1Error(me) returns Real from Standard;
226 -- returns the max angle between the result and the constraints
228 G2Error(me) returns Real from Standard;
229 -- returns the max difference of curvature between the result and the constraints
232 G0Error( me : in out; Index : Integer from Standard ) returns Real from Standard;
233 -- returns the max distance between the result and the constraint Index
235 G1Error( me : in out; Index : Integer from Standard ) returns Real from Standard;
236 -- returns the max angle between the result and the constraint Index
238 G2Error( me : in out; Index : Integer from Standard ) returns Real from Standard;
239 -- returns the max difference of curvature between the result and the constraint Index
243 myBuilder : BuildPlateSurface from GeomPlate;
244 myBoundary : SequenceOfEdgeFaceAndOrder from BRepFill;
245 myConstraints : SequenceOfEdgeFaceAndOrder from BRepFill;
246 myFreeConstraints : SequenceOfFaceAndOrder from BRepFill;
247 myPoints : SequenceOfPointConstraint from GeomPlate;
249 myOldNewMap : DataMapOfShapeListOfShape from TopTools;
250 myGenerated : ListOfShape from TopTools;
252 myFace : Face from TopoDS;
254 myInitFace : Face from TopoDS;
257 myTol2d : Real from Standard;
258 myTol3d : Real from Standard;
259 myTolAng : Real from Standard;
260 myTolCurv : Real from Standard;
262 -- Parameters of approximation
263 myMaxDeg : Integer from Standard;
264 myMaxSegments : Integer from Standard;
266 -- Parameters of resolution
267 myDegree : Integer from Standard;
268 myNbPtsOnCur : Integer from Standard;
269 myNbIter : Integer from Standard;
270 myAnisotropie : Boolean from Standard;
272 myIsInitFaceGiven : Boolean from Standard;
274 myIsDone : Boolean from Standard;