b311480e |
1 | -- Created on: 1999-06-18 |
2 | -- Created by: Galina Koulikova |
3 | -- Copyright (c) 1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
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. |
10 | -- |
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. |
13 | -- |
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. |
20 | |
7fd59977 |
21 | |
22 | private class BSplineRestriction from ShapeCustom inherits Modification from BRepTools |
23 | |
24 | ---Purpose: this tool intended for aproximation surfaces, curves and pcurves with |
25 | -- specified degree , max number of segments, tolerance 2d, tolerance 3d. Specified |
26 | -- continuity can be reduced if approximation with specified continuity was not done. |
27 | |
28 | uses |
29 | Surface from Geom, |
30 | Curve from Geom, |
31 | Curve from Geom2d, |
32 | Shape from TopoDS, |
33 | Face from TopoDS, |
34 | Edge from TopoDS, |
35 | Vertex from TopoDS, |
36 | Location from TopLoc, |
37 | Shape from GeomAbs, |
38 | Pnt from gp, |
39 | RestrictionParameters from ShapeCustom |
40 | |
41 | is |
42 | Create returns mutable BSplineRestriction from ShapeCustom; |
43 | ---Purpose: Empty constructor. |
44 | |
45 | |
46 | Create(anApproxSurfaceFlag, |
47 | anApproxCurve3dFlag, |
48 | anApproxCurve2dFlag : Boolean; |
49 | aTol3d, aTol2d : Real; |
50 | aContinuity3d, aContinuity2d: Shape from GeomAbs ; |
51 | aMaxDegree, aNbMaxSeg : Integer; |
52 | Degree, Rational : Boolean) |
53 | returns mutable BSplineRestriction from ShapeCustom; |
54 | ---Purpose: Initializes with specified parameters of aproximation. |
55 | |
56 | Create(anApproxSurfaceFlag, anApproxCurve3dFlag, anApproxCurve2dFlag: Boolean from Standard; |
57 | aTol3d, aTol2d : Real; |
58 | aContinuity3d, aContinuity2d : Shape from GeomAbs ; |
59 | aMaxDegree, aNbMaxSeg : Integer; |
60 | Degree, Rational : Boolean; |
61 | aModes : RestrictionParameters from ShapeCustom) |
62 | returns mutable BSplineRestriction from ShapeCustom; |
63 | ---Purpose: Initializes with specified parameters of aproximation. |
64 | |
65 | NewSurface(me: mutable; F : Face from TopoDS; |
66 | S : out Surface from Geom; |
67 | L : out Location from TopLoc; |
68 | Tol : out Real from Standard; |
69 | RevWires : out Boolean from Standard; |
70 | RevFace : out Boolean from Standard) |
71 | |
72 | ---Purpose: Returns Standard_True if the face <F> has been |
73 | -- modified. In this case, <S> is the new geometric |
74 | -- support of the face, <L> the new location,<Tol> |
75 | -- the new tolerance.<RevWires> has to be set to |
76 | -- Standard_True when the modification reverses the |
77 | -- normal of the surface.(the wires have to be |
78 | -- reversed). <RevFace> has to be set to |
79 | -- Standard_True if the orientation of the modified |
80 | -- face changes in the shells which contain it. |
81 | -- |
82 | -- Otherwise, returns Standard_False, and <S>, <L>, |
83 | -- <Tol> , <RevWires> ,<RevFace> are not significant. |
84 | |
85 | |
86 | returns Boolean from Standard; |
87 | |
88 | |
89 | NewCurve(me: mutable; E : Edge from TopoDS; |
90 | C : out Curve from Geom; |
91 | L : out Location from TopLoc; |
92 | Tol: out Real from Standard) |
93 | |
94 | returns Boolean from Standard; |
95 | |
96 | ---Purpose: Returns Standard_True if curve from the edge <E> has been |
97 | -- modified. In this case, <C> is the new geometric |
98 | -- support of the edge, <L> the new location, <Tol> |
99 | -- the new tolerance. |
100 | -- Otherwise, returns Standard_True if Surface is modified or |
101 | -- one of pcurves of edge is modified. In this case C is copy of |
102 | -- geometric support of the edge. |
103 | -- In other cases returns Standard_False, and <C>, <L>, <Tol> are not |
104 | -- significant. |
105 | |
106 | NewCurve2d(me: mutable; E : Edge from TopoDS; |
107 | F : Face from TopoDS; |
108 | NewE : Edge from TopoDS; |
109 | NewF : Face from TopoDS; |
110 | C : out Curve from Geom2d; |
111 | Tol : out Real from Standard) |
112 | |
113 | returns Boolean from Standard; |
114 | |
115 | ---Purpose: Returns Standard_True if the edge <E> has been modified. |
116 | -- In this case,if curve on the surface is modified, <C> |
117 | -- is the new geometric support of the edge, <L> the |
118 | -- new location, <Tol> the new tolerance. If curve on the surface |
119 | -- is not modified C is copy curve on surface from the edge <E>. |
120 | -- |
121 | -- Otherwise, returns Standard_False, and <C>, <L>, |
122 | -- <Tol> are not significant. |
123 | -- |
124 | -- <NewE> is the new edge created from <E>. <NewF> |
125 | -- is the new face created from <F>. They may be usefull. |
126 | |
127 | |
128 | ConvertSurface(me: mutable; aSurface : Surface from Geom; S : out Surface from Geom; |
129 | UF,UL,VF,VL : Real from Standard; |
130 | IsOf : Boolean from Standard = Standard_True) |
131 | returns Boolean from Standard; |
132 | ---Purpose: Returns Standard_True if the surface has been modified. |
133 | -- if flag IsOf equals Standard_True Offset surfaces are aproximated to Offset |
134 | -- if Standard_False to BSpline |
135 | |
136 | ConvertCurve(me: mutable;aCurve : in out Curve from Geom; C : out Curve from Geom; IsConvert : Boolean; |
137 | First, Last : Real; TolCur : in out Real;IsOf : Boolean from Standard = Standard_True) |
138 | returns Boolean from Standard; |
139 | ---Purpose: Returns Standard_True if the curve has been modified. |
140 | -- if flag IsOf equals Standard_True Offset curves are aproximated to Offset |
141 | -- if Standard_False to BSpline |
142 | |
143 | ConvertCurve2d(me: mutable;aCurve : in out Curve from Geom2d; C : out Curve from Geom2d; IsConvert : Boolean; |
144 | First, Last : Real; TolCur : in out Real;IsOf : Boolean from Standard = Standard_True) |
145 | returns Boolean from Standard; |
146 | ---Purpose: Returns Standard_True if the pcurve has been modified. |
147 | -- if flag IsOf equals Standard_True Offset pcurves are aproximated to Offset |
148 | -- if Standard_False to BSpline |
149 | |
150 | -- Methods for setting and obtaining fields |
151 | |
152 | SetTol3d(me: mutable; Tol3d : Real from Standard); |
153 | ---C++: inline |
154 | ---Purpose: Sets tolerance of aproximation for curve3d and surface |
155 | |
156 | SetTol2d(me: mutable; Tol2d : Real from Standard); |
157 | ---C++: inline |
158 | ---Purpose: Sets tolerance of aproximation for curve2d |
159 | |
160 | ModifyApproxSurfaceFlag(me : mutable) returns Boolean; |
161 | ---C++: inline |
162 | ---C++: return & |
163 | ---Purpose: Returns (modifiable) the flag which defines whether the |
164 | -- surface is aproximated. |
165 | |
166 | ModifyApproxCurve3dFlag(me : mutable) returns Boolean; |
167 | ---C++: inline |
168 | ---C++: return & |
169 | ---Purpose: Returns (modifiable) the flag which defines whether the |
170 | -- curve3d is aproximated. |
171 | |
172 | ModifyApproxCurve2dFlag(me : mutable) returns Boolean; |
173 | ---C++: inline |
174 | ---C++: return & |
175 | ---Purpose: Returns (modifiable) the flag which defines whether the curve2d is aproximated. |
176 | |
177 | SetContinuity3d(me : mutable; Continuity3d : Shape from GeomAbs); |
178 | ---C++: inline |
179 | ---Purpose: Sets continuity3d for aproximation curve3d and surface. |
180 | |
181 | SetContinuity2d(me : mutable; Continuity2d : Shape from GeomAbs); |
182 | ---C++: inline |
183 | ---Purpose: Sets continuity3d for aproximation curve2d. |
184 | |
185 | SetMaxDegree(me : mutable; MaxDegree : Integer from Standard); |
186 | ---C++: inline |
187 | ---Purpose: Sets max degree for aproximation. |
188 | |
189 | SetMaxNbSegments(me : mutable; MaxNbSegments : Integer from Standard); |
190 | ---C++: inline |
191 | ---Purpose: Sets max number of segments for aproximation. |
192 | |
193 | SetPriority(me : mutable; Degree : Boolean from Standard); |
194 | ---C++: inline |
195 | ---Purpose: Sets priority for aproximation curves and surface. |
196 | -- If Degree is True approximation is made with degree less |
197 | -- then specified MaxDegree at the expense of number of spanes. |
198 | -- If Degree is False approximation is made with number of |
199 | -- spans less then specified MaxNbSegment at the expense of |
200 | -- specified MaxDegree. |
201 | |
202 | SetConvRational(me : mutable; Rational : Boolean from Standard); |
203 | ---C++: inline |
204 | ---Purpose: Sets flag for define if rational BSpline or Bezier is |
205 | -- converted to polynomial. If Rational is True approximation |
206 | -- for rational BSpline and Bezier is made to polynomial even |
207 | -- if degree is less then MaxDegree and number of spans is less |
208 | -- then specified MaxNbSegment. |
209 | |
210 | GetRestrictionParameters(me) |
211 | returns RestrictionParameters from ShapeCustom; |
212 | ---C++: inline |
213 | ---Purpose: Returns the container of modes which defines |
214 | -- what geometry should be converted to BSplines. |
215 | |
216 | SetRestrictionParameters(me: mutable; |
217 | aModes: RestrictionParameters from ShapeCustom); |
218 | ---C++: inline |
219 | ---Purpose: Sets the container of modes which defines |
220 | -- what geometry should be converted to BSplines. |
221 | |
222 | Curve3dError(me) returns Real; |
223 | ---C++: inline |
224 | ---Purpose:Returns error for aproximation curve3d. |
225 | |
226 | Curve2dError(me) returns Real; |
227 | ---C++: inline |
228 | ---Purpose:Returns error for aproximation curve2d. |
229 | |
230 | SurfaceError(me) returns Real; |
231 | ---C++: inline |
232 | ---Purpose:Returns error for aproximation surface. |
233 | |
234 | NewPoint(me: mutable; V : Vertex from TopoDS; |
235 | P : out Pnt from gp; |
236 | Tol: out Real from Standard) |
237 | |
238 | returns Boolean from Standard; |
239 | |
240 | NewParameter(me: mutable; V : Vertex from TopoDS; |
241 | E : Edge from TopoDS; |
242 | P : out Real from Standard; |
243 | Tol: out Real from Standard) |
244 | |
245 | returns Boolean from Standard; |
246 | |
247 | |
248 | |
249 | |
250 | Continuity(me: mutable; E : Edge from TopoDS; |
251 | F1,F2 : Face from TopoDS; |
252 | NewE : Edge from TopoDS; |
253 | NewF1,NewF2: Face from TopoDS) |
254 | |
255 | returns Shape from GeomAbs; |
256 | |
257 | MaxErrors (me; aCurve3dErr, aCurve2dErr : out Real) returns Real from Standard; |
258 | ---Purpose:Returns error for aproximation surface, curve3d and curve2d. |
259 | |
260 | NbOfSpan (me) returns Integer from Standard; |
261 | ---Purpose:Returns number for aproximation surface, curve3d and curve2d. |
262 | |
263 | |
264 | fields |
265 | myContinuity3d, |
266 | myContinuity2d : Shape from GeomAbs; |
267 | myMaxDegree, |
268 | myNbMaxSeg : Integer from Standard; |
269 | myTol3d, |
270 | myTol2d, |
271 | mySurfaceError, |
272 | myCurve3dError, |
273 | myCurve2dError : Real from Standard; |
274 | myNbOfSpan : Integer from Standard; |
275 | myApproxSurfaceFlag, |
276 | myApproxCurve3dFlag, |
277 | myApproxCurve2dFlag : Boolean from Standard; |
278 | myDeg : Boolean from Standard; |
279 | myConvert : Boolean from Standard; |
280 | myRational : Boolean from Standard; |
281 | |
282 | myParameters : RestrictionParameters from ShapeCustom; |
283 | |
284 | |
285 | end BSplineRestriction; |