b311480e |
1 | -- Created on: 1996-03-12 |
2 | -- Created by: Bruno DUMORTIER |
3 | -- Copyright (c) 1996-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 BSplineCurveToBezierCurve from GeomConvert |
18 | |
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. |
25 | -- References : |
26 | -- Generating the Bezier points of B-spline curves and surfaces |
27 | -- (Wolfgang Bohm) CAD volume 13 number 6 november 1981 |
28 | |
29 | uses |
30 | Array1OfReal from TColStd, |
31 | Array1OfBezierCurve from TColGeom, |
32 | BezierCurve from Geom, |
33 | BSplineCurve from Geom |
34 | |
35 | |
36 | raises |
37 | DimensionError from Standard, |
38 | DomainError from Standard, |
39 | OutOfRange from Standard |
40 | |
41 | is |
42 | |
43 | |
44 | Create (BasisCurve : BSplineCurve) returns BSplineCurveToBezierCurve; |
45 | --- Purpose : Computes all the data needed to convert the |
46 | -- BSpline curve BasisCurve into a series of adjacent Bezier arcs. |
47 | |
48 | Create (BasisCurve : BSplineCurve; |
49 | U1, U2 : Real; |
50 | ParametricTolerance : Real) |
51 | returns BSplineCurveToBezierCurve |
52 | --- Purpose : Computes all the data needed to convert |
53 | -- the portion of the BSpline curve BasisCurve |
54 | -- limited by the two parameter values U1 and U2 into a series of adjacent Bezier arcs. |
55 | -- The result consists of a series of BasisCurve arcs |
56 | -- limited by points corresponding to knot values of the curve. |
57 | -- Use the available interrogation functions to ascertain |
58 | -- the number of computed Bezier arcs, and then to |
59 | -- construct each individual Bezier curve (or all Bezier curves). |
60 | -- Note: ParametricTolerance is not used. |
61 | -- Raises DomainError if U1 or U2 are out of the parametric bounds of the basis |
62 | -- curve [FirstParameter, LastParameter]. The Tolerance criterion |
63 | -- is ParametricTolerance. |
64 | -- Raised if Abs (U2 - U1) <= ParametricTolerance. |
65 | raises DomainError; |
66 | |
67 | |
6e33d3ce |
68 | Arc (me : in out; Index : Integer) returns BezierCurve |
7fd59977 |
69 | --- Purpose : Constructs and returns the Bezier curve of index |
70 | -- Index to the table of adjacent Bezier arcs |
71 | -- computed by this algorithm. |
72 | -- This Bezier curve has the same orientation as the |
73 | -- BSpline curve analyzed in this framework. |
74 | -- Exceptions |
75 | -- Standard_OutOfRange if Index is less than 1 or |
76 | -- greater than the number of adjacent Bezier arcs |
77 | -- computed by this algorithm. |
78 | raises OutOfRange |
79 | is static; |
80 | |
81 | |
82 | Arcs (me : in out; Curves : in out Array1OfBezierCurve) |
83 | --- Purpose : Constructs all the Bezier curves whose data is |
84 | -- computed by this algorithm and loads these curves into the Curves table. |
85 | -- The Bezier curves have the same orientation as the |
86 | -- BSpline curve analyzed in this framework. |
87 | -- Exceptions |
88 | -- Standard_DimensionError if the Curves array was |
89 | -- not created with the following bounds: |
90 | -- - 1 , and |
91 | -- - the number of adjacent Bezier arcs computed by |
92 | -- this algorithm (as given by the function NbArcs). |
93 | raises DimensionError |
94 | is static; |
95 | |
96 | Knots(me; TKnots : out Array1OfReal from TColStd) |
97 | ---Purpose: This methode returns the bspline's knots associated to |
98 | -- the converted arcs |
99 | raises DimensionError |
100 | --- Purpose : Raised if the length of Curves is not equal to |
101 | -- NbArcs + 1. |
102 | is static; |
103 | |
104 | NbArcs (me) returns Integer is static; |
105 | --- Purpose : |
106 | -- Returns the number of BezierCurve arcs. |
107 | -- If at the creation time you have decomposed the basis curve |
108 | -- between the parametric values UFirst, ULast the number of |
109 | -- BezierCurve arcs depends on the number of knots included inside |
110 | -- the interval [UFirst, ULast]. |
111 | -- If you have decomposed the whole basis B-spline curve the number |
112 | -- of BezierCurve arcs NbArcs is equal to the number of knots less |
113 | -- one. |
114 | |
115 | fields |
116 | |
117 | myCurve : BSplineCurve from Geom; |
118 | |
119 | end BSplineCurveToBezierCurve; |