b311480e |
1 | -- Created on: 1993-02-22 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class CurveOnSurface from Adaptor3d inherits Curve from Adaptor3d |
18 | |
19 | ---Purpose: An interface between the services provided by a curve |
20 | -- lying on a surface from the package Geom and those |
21 | -- required of the curve by algorithms which use it. The |
22 | -- curve is defined as a 2D curve from the Geom2d |
23 | -- package, in the parametric space of the surface. |
24 | |
25 | |
26 | uses |
27 | Array1OfReal from TColStd, |
28 | Pnt from gp, |
29 | Vec from gp, |
30 | Circ from gp, |
31 | Elips from gp, |
32 | Hypr from gp, |
33 | Parab from gp, |
34 | Lin from gp, |
35 | CurveType from GeomAbs, |
36 | Shape from GeomAbs, |
37 | BezierCurve from Geom, |
38 | BSplineCurve from Geom, |
39 | BSplineSurface from Geom, |
40 | HCurve from Adaptor3d, |
41 | HCurve2d from Adaptor2d, |
42 | HSurface from Adaptor3d, |
54f7544d |
43 | HSequenceOfReal from TColStd, |
44 | Pnt2d from gp, |
45 | Vec2d from gp |
46 | |
7fd59977 |
47 | raises NoSuchObject from Standard, |
48 | DomainError from Standard, |
49 | OutOfRange from Standard |
50 | |
51 | is |
52 | |
53 | Create returns CurveOnSurface; |
54 | |
55 | Create(S : HSurface from Adaptor3d) returns CurveOnSurface; |
56 | |
57 | Create (C : HCurve2d from Adaptor2d; S : HSurface from Adaptor3d) |
58 | returns CurveOnSurface; |
59 | ---Purpose: Creates a CurveOnSurface from the 2d curve <C> and |
60 | -- the surface <S>. |
61 | |
62 | Load(me : in out;S : HSurface from Adaptor3d) |
63 | ---Purpose: Changes the surface. |
64 | is static; |
65 | |
66 | Load(me : in out; C : HCurve2d from Adaptor2d) |
67 | ---Purpose: Changes the 2d curve. |
68 | is static; |
69 | |
70 | GetCurve(me) returns HCurve2d from Adaptor2d |
71 | ---C++: return const & |
72 | is static; |
73 | |
74 | GetSurface(me) returns HSurface from Adaptor3d |
75 | ---C++: return const & |
76 | is static; |
77 | |
78 | ChangeCurve(me : in out) returns HCurve2d from Adaptor2d |
79 | ---C++: return & |
80 | is static; |
81 | |
82 | ChangeSurface(me : in out) returns HSurface from Adaptor3d |
83 | ---C++: return & |
84 | is static; |
85 | |
86 | -- |
87 | -- Implementation of Curve from Adaptor3d methods |
88 | -- |
89 | |
90 | -- |
91 | -- Global methods - Apply to the whole curve. |
92 | -- |
93 | |
94 | FirstParameter(me) returns Real |
95 | is redefined static; |
96 | |
97 | LastParameter(me) returns Real |
98 | is redefined static; |
99 | |
100 | Continuity(me) returns Shape from GeomAbs |
101 | is redefined static; |
102 | |
31b1749c |
103 | NbIntervals(me; S : Shape from GeomAbs) returns Integer |
7fd59977 |
104 | ---Purpose: Returns the number of intervals for continuity |
105 | -- <S>. May be one if Continuity(me) >= <S> |
106 | is redefined static; |
107 | |
31b1749c |
108 | Intervals(me; T : in out Array1OfReal from TColStd; |
7fd59977 |
109 | S : Shape from GeomAbs) |
110 | ---Purpose: Stores in <T> the parameters bounding the intervals |
111 | -- of continuity <S>. |
112 | -- |
113 | -- The array must provide enough room to accomodate |
114 | -- for the parameters. i.e. T.Length() > NbIntervals() |
115 | raises |
116 | OutOfRange from Standard |
117 | is redefined static; |
118 | |
119 | Trim(me; First, Last, Tol : Real) returns HCurve from Adaptor3d |
120 | ---Purpose: Returns a curve equivalent of <me> between |
121 | -- parameters <First> and <Last>. <Tol> is used to |
122 | -- test for 3d points confusion. |
123 | raises |
124 | OutOfRange from Standard |
125 | ---Purpose: If <First> >= <Last> |
126 | is redefined static; |
127 | |
128 | IsClosed(me) returns Boolean |
129 | is redefined static; |
130 | |
131 | IsPeriodic(me) returns Boolean |
132 | is redefined static; |
133 | |
134 | Period(me) returns Real |
135 | raises |
136 | DomainError from Standard -- if the curve is not periodic |
137 | is redefined static; |
138 | |
139 | Value(me; U : Real) returns Pnt from gp |
140 | --- Purpose : Computes the point of parameter U on the curve. |
141 | is redefined static; |
142 | |
143 | D0 (me; U : Real; P : out Pnt from gp) |
144 | --- Purpose : Computes the point of parameter U on the curve. |
145 | is redefined static; |
146 | |
147 | D1 (me; U : Real; P : out Pnt from gp ; V : out Vec from gp) |
148 | --- Purpose : Computes the point of parameter U on the curve with its |
149 | -- first derivative. |
150 | raises |
151 | DomainError from Standard |
152 | --- Purpose : Raised if the continuity of the current interval |
153 | -- is not C1. |
154 | is redefined static; |
155 | |
156 | D2 (me; U : Real; P : out Pnt from gp; V1, V2 : out Vec from gp) |
157 | --- Purpose : |
158 | -- Returns the point P of parameter U, the first and second |
159 | -- derivatives V1 and V2. |
160 | raises |
161 | DomainError from Standard |
162 | --- Purpose : Raised if the continuity of the current interval |
163 | -- is not C2. |
164 | is redefined static; |
165 | |
166 | D3 (me; U : Real; P : out Pnt from gp; V1, V2, V3 : out Vec from gp) |
167 | --- Purpose : |
168 | -- Returns the point P of parameter U, the first, the second |
169 | -- and the third derivative. |
170 | raises |
171 | DomainError from Standard |
172 | --- Purpose : Raised if the continuity of the current interval |
173 | -- is not C3. |
174 | is redefined static; |
175 | |
176 | DN (me; U : Real; N : Integer) returns Vec from gp |
177 | --- Purpose : |
178 | -- The returned vector gives the value of the derivative for the |
179 | -- order of derivation N. |
180 | raises |
181 | DomainError from Standard, |
182 | --- Purpose : Raised if the continuity of the current interval |
183 | -- is not CN. |
184 | OutOfRange from Standard |
185 | --- Purpose : Raised if N < 1. |
186 | is redefined static; |
187 | |
188 | Resolution(me; R3d : Real) returns Real |
189 | ---Purpose : Returns the parametric resolution corresponding |
190 | -- to the real space resolution <R3d>. |
191 | is redefined static; |
192 | |
193 | GetType(me) returns CurveType from GeomAbs |
194 | ---Purpose: Returns the type of the curve in the current |
195 | -- interval : Line, Circle, Ellipse, Hyperbola, |
196 | -- Parabola, BezierCurve, BSplineCurve, OtherCurve. |
197 | is redefined static; |
198 | |
199 | -- |
200 | -- The following methods must be called when GetType returned |
201 | -- the corresponding type. |
202 | -- |
203 | |
204 | Line(me) returns Lin from gp |
205 | raises |
206 | NoSuchObject from Standard |
207 | is redefined static; |
208 | |
209 | Circle(me) returns Circ from gp |
210 | raises |
211 | NoSuchObject from Standard |
212 | is redefined static; |
213 | |
214 | Ellipse(me) returns Elips from gp |
215 | raises |
216 | NoSuchObject from Standard |
217 | is redefined static; |
218 | |
219 | Hyperbola(me) returns Hypr from gp |
220 | raises |
221 | NoSuchObject from Standard |
222 | is redefined static; |
223 | |
224 | Parabola(me) returns Parab from gp |
225 | raises |
226 | NoSuchObject from Standard |
227 | is redefined static; |
228 | |
229 | Degree(me) returns Integer |
230 | raises |
231 | NoSuchObject from Standard |
232 | is redefined static; |
233 | |
234 | |
235 | IsRational(me) returns Boolean |
236 | raises |
237 | NoSuchObject from Standard |
238 | is redefined static; |
239 | |
240 | NbPoles(me) returns Integer |
241 | raises |
242 | NoSuchObject from Standard |
243 | is redefined static; |
244 | |
245 | |
246 | NbKnots(me) returns Integer |
247 | raises |
248 | NoSuchObject from Standard |
249 | is redefined static; |
250 | ---Warning: will raize if this asked on a curve |
251 | -- that is not planar |
252 | |
253 | Bezier(me) returns BezierCurve from Geom |
254 | raises |
255 | NoSuchObject from Standard |
256 | is redefined static; |
257 | |
258 | BSpline(me) returns BSplineCurve from Geom |
259 | raises |
260 | NoSuchObject from Standard |
261 | is redefined static; |
262 | |
263 | EvalKPart(me : in out) |
264 | is static private; |
265 | |
266 | EvalFirstLastSurf(me : in out) |
267 | ---Purpose: Evaluates myFirstSurf and myLastSurf |
268 | -- for trimming the curve on surface. |
269 | is static private; |
270 | |
271 | |
272 | ---Purpose: Following methods output left-bottom and right-top points |
273 | -- of located part on surface |
274 | -- for trimming the curve on surface. |
275 | |
276 | LocatePart(me; UV : Pnt2d from gp; DUV : Vec2d from gp; |
277 | S : HSurface from Adaptor3d; |
278 | LeftBot, RightTop : out Pnt2d from gp) |
279 | is static private; |
280 | |
281 | LocatePart_RevExt(me; UV : Pnt2d from gp; DUV : Vec2d from gp; |
282 | S : HSurface from Adaptor3d; |
283 | LeftBot, RightTop : out Pnt2d from gp) |
284 | returns Boolean |
285 | is static private; |
286 | |
287 | LocatePart_Offset(me; UV : Pnt2d from gp; DUV : Vec2d from gp; |
288 | S : HSurface from Adaptor3d; |
289 | LeftBot, RightTop : out Pnt2d from gp) |
290 | returns Boolean |
291 | is static private; |
292 | |
293 | FindBounds(me; Arr : Array1OfReal from TColStd; |
294 | XYComp : Real from Standard; |
295 | DUVComp : Real from Standard; |
296 | Bnd1 : out Integer from Standard; |
297 | Bnd2 : out Integer from Standard; |
298 | DerIsNull : out Boolean from Standard) |
299 | ---Purpose: Extracts the numbers of knots which equal |
300 | -- the point and checks derivative components |
301 | -- by zero equivalence. |
302 | is static private; |
303 | |
304 | |
305 | |
306 | fields |
307 | |
308 | mySurface : HSurface from Adaptor3d; |
309 | myCurve : HCurve2d from Adaptor2d; |
310 | |
311 | myType : CurveType from GeomAbs; |
312 | myCirc : Circ from gp; |
313 | myLin : Lin from gp; |
314 | |
315 | myFirstSurf : HSurface from Adaptor3d; |
316 | myLastSurf : HSurface from Adaptor3d; |
317 | |
54f7544d |
318 | myIntervals : HSequenceOfReal from TColStd; |
7fd59977 |
319 | myIntCont : Shape from GeomAbs; |
320 | |
321 | end CurveOnSurface; |
322 | |
323 | |
324 | |
325 | |