1 -- Created on: 1993-02-22
2 -- Created by: Modelistation
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
24 class CurveOnSurface from Adaptor3d inherits Curve from Adaptor3d
26 ---Purpose: An interface between the services provided by a curve
27 -- lying on a surface from the package Geom and those
28 -- required of the curve by algorithms which use it. The
29 -- curve is defined as a 2D curve from the Geom2d
30 -- package, in the parametric space of the surface.
34 Array1OfReal from TColStd,
42 CurveType from GeomAbs,
44 BezierCurve from Geom,
45 BSplineCurve from Geom,
46 BSplineSurface from Geom,
47 HCurve from Adaptor3d,
48 HCurve2d from Adaptor2d,
49 HSurface from Adaptor3d,
50 HArray1OfReal from TColStd,
54 raises NoSuchObject from Standard,
55 DomainError from Standard,
56 OutOfRange from Standard
60 Create returns CurveOnSurface;
62 Create(S : HSurface from Adaptor3d) returns CurveOnSurface;
64 Create (C : HCurve2d from Adaptor2d; S : HSurface from Adaptor3d)
65 returns CurveOnSurface;
66 ---Purpose: Creates a CurveOnSurface from the 2d curve <C> and
69 Load(me : in out;S : HSurface from Adaptor3d)
70 ---Purpose: Changes the surface.
73 Load(me : in out; C : HCurve2d from Adaptor2d)
74 ---Purpose: Changes the 2d curve.
77 GetCurve(me) returns HCurve2d from Adaptor2d
78 ---C++: return const &
81 GetSurface(me) returns HSurface from Adaptor3d
82 ---C++: return const &
85 ChangeCurve(me : in out) returns HCurve2d from Adaptor2d
89 ChangeSurface(me : in out) returns HSurface from Adaptor3d
94 -- Implementation of Curve from Adaptor3d methods
98 -- Global methods - Apply to the whole curve.
101 FirstParameter(me) returns Real
104 LastParameter(me) returns Real
107 Continuity(me) returns Shape from GeomAbs
110 NbIntervals(me: in out; S : Shape from GeomAbs) returns Integer
111 ---Purpose: Returns the number of intervals for continuity
112 -- <S>. May be one if Continuity(me) >= <S>
115 Intervals(me:in out; T : in out Array1OfReal from TColStd;
116 S : Shape from GeomAbs)
117 ---Purpose: Stores in <T> the parameters bounding the intervals
118 -- of continuity <S>.
120 -- The array must provide enough room to accomodate
121 -- for the parameters. i.e. T.Length() > NbIntervals()
123 OutOfRange from Standard
126 Trim(me; First, Last, Tol : Real) returns HCurve from Adaptor3d
127 ---Purpose: Returns a curve equivalent of <me> between
128 -- parameters <First> and <Last>. <Tol> is used to
129 -- test for 3d points confusion.
131 OutOfRange from Standard
132 ---Purpose: If <First> >= <Last>
135 IsClosed(me) returns Boolean
138 IsPeriodic(me) returns Boolean
141 Period(me) returns Real
143 DomainError from Standard -- if the curve is not periodic
146 Value(me; U : Real) returns Pnt from gp
147 --- Purpose : Computes the point of parameter U on the curve.
150 D0 (me; U : Real; P : out Pnt from gp)
151 --- Purpose : Computes the point of parameter U on the curve.
154 D1 (me; U : Real; P : out Pnt from gp ; V : out Vec from gp)
155 --- Purpose : Computes the point of parameter U on the curve with its
158 DomainError from Standard
159 --- Purpose : Raised if the continuity of the current interval
163 D2 (me; U : Real; P : out Pnt from gp; V1, V2 : out Vec from gp)
165 -- Returns the point P of parameter U, the first and second
166 -- derivatives V1 and V2.
168 DomainError from Standard
169 --- Purpose : Raised if the continuity of the current interval
173 D3 (me; U : Real; P : out Pnt from gp; V1, V2, V3 : out Vec from gp)
175 -- Returns the point P of parameter U, the first, the second
176 -- and the third derivative.
178 DomainError from Standard
179 --- Purpose : Raised if the continuity of the current interval
183 DN (me; U : Real; N : Integer) returns Vec from gp
185 -- The returned vector gives the value of the derivative for the
186 -- order of derivation N.
188 DomainError from Standard,
189 --- Purpose : Raised if the continuity of the current interval
191 OutOfRange from Standard
192 --- Purpose : Raised if N < 1.
195 Resolution(me; R3d : Real) returns Real
196 ---Purpose : Returns the parametric resolution corresponding
197 -- to the real space resolution <R3d>.
200 GetType(me) returns CurveType from GeomAbs
201 ---Purpose: Returns the type of the curve in the current
202 -- interval : Line, Circle, Ellipse, Hyperbola,
203 -- Parabola, BezierCurve, BSplineCurve, OtherCurve.
207 -- The following methods must be called when GetType returned
208 -- the corresponding type.
211 Line(me) returns Lin from gp
213 NoSuchObject from Standard
216 Circle(me) returns Circ from gp
218 NoSuchObject from Standard
221 Ellipse(me) returns Elips from gp
223 NoSuchObject from Standard
226 Hyperbola(me) returns Hypr from gp
228 NoSuchObject from Standard
231 Parabola(me) returns Parab from gp
233 NoSuchObject from Standard
236 Degree(me) returns Integer
238 NoSuchObject from Standard
242 IsRational(me) returns Boolean
244 NoSuchObject from Standard
247 NbPoles(me) returns Integer
249 NoSuchObject from Standard
253 NbKnots(me) returns Integer
255 NoSuchObject from Standard
257 ---Warning: will raize if this asked on a curve
258 -- that is not planar
260 Bezier(me) returns BezierCurve from Geom
262 NoSuchObject from Standard
265 BSpline(me) returns BSplineCurve from Geom
267 NoSuchObject from Standard
270 EvalKPart(me : in out)
273 EvalFirstLastSurf(me : in out)
274 ---Purpose: Evaluates myFirstSurf and myLastSurf
275 -- for trimming the curve on surface.
279 ---Purpose: Following methods output left-bottom and right-top points
280 -- of located part on surface
281 -- for trimming the curve on surface.
283 LocatePart(me; UV : Pnt2d from gp; DUV : Vec2d from gp;
284 S : HSurface from Adaptor3d;
285 LeftBot, RightTop : out Pnt2d from gp)
288 LocatePart_RevExt(me; UV : Pnt2d from gp; DUV : Vec2d from gp;
289 S : HSurface from Adaptor3d;
290 LeftBot, RightTop : out Pnt2d from gp)
294 LocatePart_Offset(me; UV : Pnt2d from gp; DUV : Vec2d from gp;
295 S : HSurface from Adaptor3d;
296 LeftBot, RightTop : out Pnt2d from gp)
300 FindBounds(me; Arr : Array1OfReal from TColStd;
301 XYComp : Real from Standard;
302 DUVComp : Real from Standard;
303 Bnd1 : out Integer from Standard;
304 Bnd2 : out Integer from Standard;
305 DerIsNull : out Boolean from Standard)
306 ---Purpose: Extracts the numbers of knots which equal
307 -- the point and checks derivative components
308 -- by zero equivalence.
315 mySurface : HSurface from Adaptor3d;
316 myCurve : HCurve2d from Adaptor2d;
318 myType : CurveType from GeomAbs;
319 myCirc : Circ from gp;
322 myFirstSurf : HSurface from Adaptor3d;
323 myLastSurf : HSurface from Adaptor3d;
325 myIntervals : HArray1OfReal from TColStd;
326 myIntCont : Shape from GeomAbs;