42cf5bc1 |
1 | // Created on: 1997-11-21 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1997-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_Sweep_HeaderFile |
18 | #define _BRepFill_Sweep_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Real.hxx> |
26 | #include <GeomFill_ApproxStyle.hxx> |
27 | #include <GeomAbs_Shape.hxx> |
28 | #include <Standard_Integer.hxx> |
29 | #include <TopoDS_Shape.hxx> |
30 | #include <TopTools_HArray2OfShape.hxx> |
31 | #include <TopTools_DataMapOfShapeShape.hxx> |
32 | #include <TopTools_ListOfShape.hxx> |
33 | #include <TopoDS_Wire.hxx> |
34 | #include <TopTools_MapOfShape.hxx> |
35 | #include <BRepFill_DataMapOfShapeHArray2OfShape.hxx> |
36 | #include <BRepFill_TransitionStyle.hxx> |
37 | class BRepFill_LocationLaw; |
38 | class BRepFill_SectionLaw; |
39 | class StdFail_NotDone; |
40 | class Standard_OutOfRange; |
41 | class Standard_ConstructionError; |
42 | class TopoDS_Wire; |
43 | class TopoDS_Shape; |
44 | class TopoDS_Edge; |
45 | |
46 | |
47 | //! Topological Sweep Algorithm |
48 | //! Computes an Sweep shell using a generating |
49 | //! wire, an SectionLaw and an LocationLaw. |
50 | class BRepFill_Sweep |
51 | { |
52 | public: |
53 | |
54 | DEFINE_STANDARD_ALLOC |
55 | |
56 | |
57 | Standard_EXPORT BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section, const Handle(BRepFill_LocationLaw)& Location, const Standard_Boolean WithKPart); |
58 | |
59 | Standard_EXPORT void SetBounds (const TopoDS_Wire& FirstShape, const TopoDS_Wire& LastShape); |
60 | |
61 | //! Set Approximation Tolerance |
62 | //! Tol3d : Tolerance to surface approximation |
63 | //! Tol2d : Tolerance used to perform curve approximation |
64 | //! Normaly the 2d curve are approximated with a |
65 | //! tolerance given by the resolution on support surfaces, |
66 | //! but if this tolerance is too large Tol2d is used. |
67 | //! TolAngular : Tolerance (in radian) to control the angle |
68 | //! beetween tangents on the section law and |
69 | //! tangent of iso-v on approximed surface |
70 | Standard_EXPORT void SetTolerance (const Standard_Real Tol3d, const Standard_Real BoundTol = 1.0, const Standard_Real Tol2d = 1.0e-5, const Standard_Real TolAngular = 1.0e-2); |
71 | |
72 | //! Tolerance To controle Corner management. |
73 | //! |
74 | //! If the discontinuity is lesser than <AngleMin> in radian The |
75 | //! Transition Performed will be alway "Modified" |
76 | Standard_EXPORT void SetAngularControl (const Standard_Real AngleMin = 0.01, const Standard_Real AngleMax = 6.0); |
77 | |
78 | //! Set the flag that indicates attempt to approximate |
79 | //! a C1-continuous surface if a swept surface proved |
80 | //! to be C0. |
81 | Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1); |
82 | |
83 | //! Build the Sweeep Surface |
84 | //! Transition define Transition strategy |
85 | //! Approx define Approximation Strategy |
86 | //! - GeomFill_Section : The composed Function Location X Section |
87 | //! is directly approximed. |
88 | //! - GeomFill_Location : The location law is approximed, and the |
89 | //! SweepSurface is bulid algebric composition |
90 | //! of approximed location law and section law |
91 | //! This option is Ok, if Section.Surface() methode |
92 | //! is effective. |
93 | //! Continuity : The continuity in v waiting on the surface |
94 | //! Degmax : The maximum degree in v requiered on the surface |
95 | //! Segmax : The maximum number of span in v requiered on |
96 | //! the surface. |
97 | Standard_EXPORT void Build (TopTools_MapOfShape& ReversedEdges, BRepFill_DataMapOfShapeHArray2OfShape& Tapes, BRepFill_DataMapOfShapeHArray2OfShape& Rails, const BRepFill_TransitionStyle Transition = BRepFill_Modified, const GeomAbs_Shape Continuity = GeomAbs_C2, const GeomFill_ApproxStyle Approx = GeomFill_Location, const Standard_Integer Degmax = 11, const Standard_Integer Segmax = 30); |
98 | |
99 | //! Say if the Shape is Build. |
100 | Standard_EXPORT Standard_Boolean IsDone() const; |
101 | |
102 | //! returns the Sweeping Shape |
103 | Standard_EXPORT TopoDS_Shape Shape() const; |
104 | |
105 | //! Get the Approximation error. |
106 | Standard_EXPORT Standard_Real ErrorOnSurface() const; |
107 | |
108 | Standard_EXPORT Handle(TopTools_HArray2OfShape) SubShape() const; |
109 | |
110 | Standard_EXPORT Handle(TopTools_HArray2OfShape) InterFaces() const; |
111 | |
112 | Standard_EXPORT Handle(TopTools_HArray2OfShape) Sections() const; |
113 | |
953d87f3 |
114 | //! returns the Tape corresponding to Index-th edge of section |
115 | Standard_EXPORT TopoDS_Shape Tape(const Standard_Integer Index) const; |
42cf5bc1 |
116 | |
117 | |
118 | |
119 | protected: |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | private: |
126 | |
127 | |
128 | Standard_EXPORT Standard_Boolean CorrectApproxParameters(); |
129 | |
130 | Standard_EXPORT Standard_Boolean BuildWire (const BRepFill_TransitionStyle Transition); |
131 | |
132 | Standard_EXPORT Standard_Boolean BuildShell (const BRepFill_TransitionStyle Transition, const Standard_Integer Vf, const Standard_Integer Vl, TopTools_MapOfShape& ReversedEdges, BRepFill_DataMapOfShapeHArray2OfShape& Tapes, BRepFill_DataMapOfShapeHArray2OfShape& Rails, const Standard_Real ExtendFirst = 0.0, const Standard_Real ExtendLast = 0.0); |
133 | |
134 | Standard_EXPORT void PerformCorner (const Standard_Integer Index, const BRepFill_TransitionStyle Transition, const Handle(TopTools_HArray2OfShape)& Bounds); |
135 | |
136 | Standard_EXPORT Standard_Real EvalExtrapol (const Standard_Integer Index, const BRepFill_TransitionStyle Transition) const; |
137 | |
138 | Standard_EXPORT Standard_Boolean MergeVertex (const TopoDS_Shape& V1, TopoDS_Shape& V2) const; |
139 | |
140 | Standard_EXPORT void UpdateVertex (const Standard_Integer Ipath, const Standard_Integer Isec, const Standard_Real Error, const Standard_Real Param, TopoDS_Shape& V) const; |
141 | |
142 | Standard_EXPORT void RebuildTopOrBottomEdge (const TopoDS_Edge& aNewEdge, TopoDS_Edge& anEdge, TopTools_MapOfShape& ReversedEdges) const; |
143 | |
144 | |
145 | Standard_Boolean isDone; |
146 | Standard_Boolean KPart; |
147 | Standard_Real myTol3d; |
148 | Standard_Real myBoundTol; |
149 | Standard_Real myTol2d; |
150 | Standard_Real myTolAngular; |
151 | Standard_Real myAngMin; |
152 | Standard_Real myAngMax; |
153 | GeomFill_ApproxStyle myApproxStyle; |
154 | GeomAbs_Shape myContinuity; |
155 | Standard_Integer myDegmax; |
156 | Standard_Integer mySegmax; |
157 | Standard_Boolean myForceApproxC1; |
158 | TopoDS_Shape myShape; |
159 | Handle(BRepFill_LocationLaw) myLoc; |
160 | Handle(BRepFill_SectionLaw) mySec; |
161 | Handle(TopTools_HArray2OfShape) myUEdges; |
162 | Handle(TopTools_HArray2OfShape) myVEdges; |
163 | TopTools_DataMapOfShapeShape myVEdgesModified; |
164 | Handle(TopTools_HArray2OfShape) myFaces; |
165 | TopTools_ListOfShape myAuxShape; |
953d87f3 |
166 | Handle(TopTools_HArray1OfShape) myTapes; |
42cf5bc1 |
167 | Standard_Real Error; |
168 | TopoDS_Wire FirstShape; |
169 | TopoDS_Wire LastShape; |
170 | |
171 | |
172 | }; |
173 | |
174 | |
175 | |
176 | |
177 | |
178 | |
179 | |
180 | #endif // _BRepFill_Sweep_HeaderFile |