1 -- Created on: 1993-03-24
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class BSplineCurveToBezierCurve from Geom2dConvert
19 --- Purpose :An algorithm to convert a BSpline curve into a series
20 -- of adjacent Bezier curves.
21 -- A BSplineCurveToBezierCurve object provides a framework for:
22 -- - defining the BSpline curve to be converted
23 -- - implementing the construction algorithm, and
24 -- - consulting the results.
26 -- Generating the Bezier points of B-spline curves and surfaces
27 -- (Wolfgang Bohm) CAD volume 13 number 6 november 1981
31 Array1OfReal from TColStd,
32 Array1OfBezierCurve from TColGeom2d,
33 BezierCurve from Geom2d,
34 BSplineCurve from Geom2d
38 DimensionError from Standard,
39 DomainError from Standard,
40 OutOfRange from Standard
45 Create (BasisCurve : BSplineCurve) returns BSplineCurveToBezierCurve;
46 --- Purpose : Computes all the data needed to convert
47 -- - the BSpline curve BasisCurve, into a series of adjacent Bezier arcs.
48 -- The result consists of a series of BasisCurve arcs
49 -- limited by points corresponding to knot values of the curve.
50 -- Use the available interrogation functions to ascertain
51 -- the number of computed Bezier arcs, and then to
52 -- construct each individual Bezier curve (or all Bezier curves).
53 -- Note: ParametricTolerance is not used.
55 Create (BasisCurve : BSplineCurve;
57 ParametricTolerance : Real)
58 returns BSplineCurveToBezierCurve
59 --- Purpose : Computes all the data needed to convert
60 -- the portion of the BSpline curve BasisCurve
61 -- limited by the two parameter values U1 and U2
62 -- for Example if there is a Knot Uk and
63 -- Uk < U < Uk + ParametricTolerance/2 the last curve
64 -- corresponds to the span [Uk-1, Uk] and not to [Uk, Uk+1]
65 -- The result consists of a series of BasisCurve arcs
66 -- limited by points corresponding to knot values of the curve.
67 -- Use the available interrogation functions to ascertain
68 -- the number of computed Bezier arcs, and then to
69 -- construct each individual Bezier curve (or all Bezier curves).
70 -- Note: ParametricTolerance is not used.
71 -- Raises DomainError if U1 or U2 are out of the parametric bounds of the basis
72 -- curve [FirstParameter, LastParameter]. The Tolerance criterion
73 -- is ParametricTolerance.
74 -- Raised if Abs (U2 - U1) <= ParametricTolerance.
78 Arc (me : in out; Index : Integer) returns BezierCurve
79 --- Purpose :Constructs and returns the Bezier curve of index
80 -- Index to the table of adjacent Bezier arcs
81 -- computed by this algorithm.
82 -- This Bezier curve has the same orientation as the
83 -- BSpline curve analyzed in this framework.
85 -- Standard_OutOfRange if Index is less than 1 or
86 -- greater than the number of adjacent Bezier arcs
87 -- computed by this algorithm.
92 Arcs (me : in out; Curves : in out Array1OfBezierCurve)
93 --- Purpose :Constructs all the Bezier curves whose data is
94 -- computed by this algorithm and loads these curves
95 -- into the Curves table.
96 -- The Bezier curves have the same orientation as the
97 -- BSpline curve analyzed in this framework.
99 -- Standard_DimensionError if the Curves array was
100 -- not created with the following bounds:
102 -- - the number of adjacent Bezier arcs computed by
103 -- this algorithm (as given by the function NbArcs).
104 raises DimensionError
107 Knots(me; TKnots : out Array1OfReal from TColStd)
108 ---Purpose: This methode returns the bspline's knots associated to
109 -- the converted arcs
110 -- Raises DimensionError if the length of Curves is not equal to
112 raises DimensionError
115 NbArcs (me) returns Integer is static;
117 -- Returns the number of BezierCurve arcs.
118 -- If at the creation time you have decomposed the basis curve
119 -- between the parametric values UFirst, ULast the number of
120 -- BezierCurve arcs depends on the number of knots included inside
121 -- the interval [UFirst, ULast].
122 -- If you have decomposed the whole basis B-spline curve the number
123 -- of BezierCurve arcs NbArcs is equal to the number of knots less
128 myCurve : BSplineCurve from Geom2d;
129 end BSplineCurveToBezierCurve;