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