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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepFill_Filling_HeaderFile
18 #define _BRepFill_Filling_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <GeomPlate_BuildPlateSurface.hxx>
25 #include <BRepFill_SequenceOfEdgeFaceAndOrder.hxx>
26 #include <BRepFill_SequenceOfFaceAndOrder.hxx>
27 #include <GeomPlate_SequenceOfPointConstraint.hxx>
28 #include <TopTools_DataMapOfShapeShape.hxx>
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>
36 class StdFail_NotDone;
37 class Standard_OutOfRange;
38 class Standard_ConstructionError;
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.
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.
58 //! If no initial surface is given, the algorithm computes it
60 //! If the set of edges is not connected (Free constraint)
61 //! missing edges are automatically computed.
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.
71 //! Other Applications:
72 //! * Deformation of a face to satisfy internal constraints
73 //! * Deformation of a face to improve Gi continuity with
75 class BRepFill_Filling
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);
85 //! Sets the values of Tolerances used to control the constraint.
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);
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
103 //! NbPtsOnCur: it is the average number of points for discretisation
105 //! NbIter: it is the maximum number of iterations of the process.
106 //! For each iteration the number of discretisation points is
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);
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);
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
120 Standard_EXPORT void LoadInitSurface (const TopoDS_Face& aFace);
122 //! Adds a new constraint which also defines an edge of the wire
124 //! Order: Order of the constraint:
125 //! GeomAbs_C0 : the surface has to pass by 3D representation
127 //! GeomAbs_G1 : the surface has to pass by 3D representation
128 //! of the edge and to respect tangency with the first
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);
135 //! Adds a new constraint which also defines an edge of the wire
137 //! Order: Order of the constraint:
138 //! GeomAbs_C0 : the surface has to pass by 3D representation
140 //! GeomAbs_G1 : the surface has to pass by 3D representation
141 //! of the edge and to respect tangency with the
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);
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);
153 //! Adds a punctual constraint
154 Standard_EXPORT Standard_Integer Add (const gp_Pnt& Point);
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);
159 //! Builds the resulting faces
160 Standard_EXPORT void Build();
162 Standard_EXPORT Standard_Boolean IsDone() const;
164 Standard_EXPORT TopoDS_Face Face() const;
166 //! Returns the list of shapes generated from the
168 Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& S);
170 Standard_EXPORT Standard_Real G0Error() const;
172 Standard_EXPORT Standard_Real G1Error() const;
174 Standard_EXPORT Standard_Real G2Error() const;
176 Standard_EXPORT Standard_Real G0Error (const Standard_Integer Index);
178 Standard_EXPORT Standard_Real G1Error (const Standard_Integer Index);
180 Standard_EXPORT Standard_Real G2Error (const Standard_Integer Index);
194 //! Adds constraints to builder
195 Standard_EXPORT void AddConstraints (const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints);
197 //! Builds wires of maximum length
198 Standard_EXPORT void BuildWires (TopTools_ListOfShape& EdgeList, TopTools_ListOfShape& WireList);
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;
205 GeomPlate_BuildPlateSurface myBuilder;
206 BRepFill_SequenceOfEdgeFaceAndOrder myBoundary;
207 BRepFill_SequenceOfEdgeFaceAndOrder myConstraints;
208 BRepFill_SequenceOfFaceAndOrder myFreeConstraints;
209 GeomPlate_SequenceOfPointConstraint myPoints;
210 TopTools_DataMapOfShapeShape myOldNewMap;
211 TopTools_ListOfShape myGenerated;
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;
236 #endif // _BRepFill_Filling_HeaderFile