42cf5bc1 |
1 | // Created on: 1995-07-17 |
2 | // Created by: Jing-Cheng MEI |
3 | // Copyright (c) 1995-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 _BRepOffsetAPI_ThruSections_HeaderFile |
18 | #define _BRepOffsetAPI_ThruSections_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopTools_SequenceOfShape.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Real.hxx> |
27 | #include <TopoDS_Face.hxx> |
28 | #include <TopTools_DataMapOfShapeShape.hxx> |
29 | #include <GeomAbs_Shape.hxx> |
30 | #include <Approx_ParametrizationType.hxx> |
31 | #include <Standard_Integer.hxx> |
32 | #include <BRepBuilderAPI_MakeShape.hxx> |
33 | #include <TopTools_Array1OfShape.hxx> |
34 | class Standard_DomainError; |
35 | class TopoDS_Wire; |
36 | class TopoDS_Vertex; |
37 | class TopoDS_Shape; |
38 | class Geom_BSplineSurface; |
39 | |
40 | |
41 | //! Describes functions to build a loft. This is a shell or a |
42 | //! solid passing through a set of sections in a given |
43 | //! sequence. Usually sections are wires, but the first and |
44 | //! the last sections may be vertices (punctual sections). |
45 | class BRepOffsetAPI_ThruSections : public BRepBuilderAPI_MakeShape |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | //! Initializes an algorithm for building a shell or a solid |
53 | //! passing through a set of sections, where: |
54 | //! - isSolid is set to true if the construction algorithm is |
55 | //! required to build a solid or to false if it is required to build |
56 | //! a shell (the default value), |
57 | //! - ruled is set to true if the faces generated between |
58 | //! the edges of two consecutive wires are ruled surfaces or to |
59 | //! false (the default value) if they are smoothed out by approximation, |
60 | //! - pres3d defines the precision criterion used by the |
61 | //! approximation algorithm; the default value is 1.0e-6. |
62 | //! Use AddWire and AddVertex to define the |
63 | //! successive sections of the shell or solid to be built. |
64 | Standard_EXPORT BRepOffsetAPI_ThruSections(const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06); |
65 | |
66 | //! Initializes this algorithm for building a shell or a solid |
67 | //! passing through a set of sections, where: |
68 | //! - isSolid is set to true if this construction algorithm is |
69 | //! required to build a solid or to false if it is required to |
70 | //! build a shell. false is the default value; |
71 | //! - ruled is set to true if the faces generated between the |
72 | //! edges of two consecutive wires are ruled surfaces or |
73 | //! to false (the default value) if they are smoothed out by approximation, |
74 | //! - pres3d defines the precision criterion used by the |
75 | //! approximation algorithm; the default value is 1.0e-6. |
76 | //! Use AddWire and AddVertex to define the successive |
77 | //! sections of the shell or solid to be built. |
78 | Standard_EXPORT void Init (const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06); |
79 | |
80 | //! Adds the wire wire to the set of |
81 | //! sections through which the shell or solid is built. |
82 | //! Use the Build function to construct the shape. |
83 | Standard_EXPORT void AddWire (const TopoDS_Wire& wire); |
84 | |
85 | //! Adds the vertex Vertex (punctual section) to the set of sections |
86 | //! through which the shell or solid is built. A vertex may be added to the |
87 | //! set of sections only as first or last section. At least one wire |
88 | //! must be added to the set of sections by the method AddWire. |
89 | //! Use the Build function to construct the shape. |
90 | Standard_EXPORT void AddVertex (const TopoDS_Vertex& aVertex); |
91 | |
92 | //! Sets/unsets the option to |
93 | //! compute origin and orientation on wires to avoid twisted results |
94 | //! and update wires to have same number of edges. |
95 | Standard_EXPORT void CheckCompatibility (const Standard_Boolean check = Standard_True); |
96 | |
97 | //! Define the approximation algorithm |
98 | Standard_EXPORT void SetSmoothing (const Standard_Boolean UseSmoothing); |
99 | |
100 | //! Define the type of parametrization used in the approximation |
101 | Standard_EXPORT void SetParType (const Approx_ParametrizationType ParType); |
102 | |
103 | //! Define the Continuity used in the approximation |
104 | Standard_EXPORT void SetContinuity (const GeomAbs_Shape C); |
105 | |
106 | //! define the Weights associed to the criterium used in |
107 | //! the optimization. |
108 | //! |
109 | //! if Wi <= 0 |
110 | Standard_EXPORT void SetCriteriumWeight (const Standard_Real W1, const Standard_Real W2, const Standard_Real W3); |
111 | |
112 | //! Define the maximal U degree of result surface |
113 | Standard_EXPORT void SetMaxDegree (const Standard_Integer MaxDeg); |
114 | |
115 | //! returns the type of parametrization used in the approximation |
116 | Standard_EXPORT Approx_ParametrizationType ParType() const; |
117 | |
118 | //! returns the Continuity used in the approximation |
119 | Standard_EXPORT GeomAbs_Shape Continuity() const; |
120 | |
121 | //! returns the maximal U degree of result surface |
122 | Standard_EXPORT Standard_Integer MaxDegree() const; |
123 | |
124 | //! Define the approximation algorithm |
125 | Standard_EXPORT Standard_Boolean UseSmoothing() const; |
126 | |
127 | //! returns the Weights associed to the criterium used in |
128 | //! the optimization. |
129 | Standard_EXPORT void CriteriumWeight (Standard_Real& W1, Standard_Real& W2, Standard_Real& W3) const; |
130 | |
131 | Standard_EXPORT virtual void Build() Standard_OVERRIDE; |
132 | |
133 | //! Returns the TopoDS Shape of the bottom of the loft if solid |
134 | Standard_EXPORT const TopoDS_Shape& FirstShape() const; |
135 | |
136 | //! Returns the TopoDS Shape of the top of the loft if solid |
137 | Standard_EXPORT const TopoDS_Shape& LastShape() const; |
138 | |
139 | //! if Ruled |
140 | //! Returns the Face generated by each edge |
141 | //! except the last wire |
142 | //! if smoothed |
143 | //! Returns the Face generated by each edge of the first wire |
144 | Standard_EXPORT TopoDS_Shape GeneratedFace (const TopoDS_Shape& Edge) const; |
145 | |
146 | |
147 | |
148 | |
149 | protected: |
150 | |
151 | |
152 | |
153 | |
154 | |
155 | private: |
156 | |
157 | |
158 | Standard_EXPORT void CreateRuled(); |
159 | |
160 | Standard_EXPORT void CreateSmoothed(); |
161 | |
162 | Standard_EXPORT Handle(Geom_BSplineSurface) TotalSurf (const TopTools_Array1OfShape& shapes, const Standard_Integer NbSect, const Standard_Integer NbEdges, const Standard_Boolean w1Point, const Standard_Boolean w2Point, const Standard_Boolean vClosed) const; |
163 | |
164 | |
165 | TopTools_SequenceOfShape myWires; |
166 | Standard_Boolean myIsSolid; |
167 | Standard_Boolean myIsRuled; |
168 | Standard_Boolean myWCheck; |
169 | Standard_Real myPres3d; |
170 | TopoDS_Face myFirst; |
171 | TopoDS_Face myLast; |
172 | TopTools_DataMapOfShapeShape myGenerated; |
173 | GeomAbs_Shape myContinuity; |
174 | Approx_ParametrizationType myParamType; |
175 | Standard_Integer myDegMax; |
176 | Standard_Real myCritWeights[3]; |
177 | Standard_Boolean myUseSmoothing; |
178 | |
179 | |
180 | }; |
181 | |
182 | |
183 | |
184 | |
185 | |
186 | |
187 | |
188 | #endif // _BRepOffsetAPI_ThruSections_HeaderFile |