b311480e |
1 | -- Created on: 1993-11-09 |
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 CompBezierCurves2dToBSplineCurve2d from Convert |
18 | |
19 | ---Purpose: Converts a list of connecting Bezier Curves 2d to a |
20 | -- BSplineCurve 2d. |
21 | -- if possible, the continuity of the BSpline will be |
22 | -- increased to more than C0. |
23 | |
24 | |
25 | uses |
26 | SequenceOfReal from TColStd, |
27 | SequenceOfInteger from TColStd, |
28 | Array1OfReal from TColStd, |
29 | Array1OfInteger from TColStd, |
30 | Array1OfPnt2d from TColgp, |
31 | SequenceOfPnt2d from TColgp, |
32 | SequenceOfArray1OfPoles2d from Convert |
33 | |
34 | |
35 | raises |
36 | ConstructionError from Standard |
37 | |
38 | ------------------------------------------------------------------------- |
39 | --- Don't forget to use the method Perform before accessing the Result. |
40 | ------------------------------------------------------------------------- |
41 | |
42 | is |
43 | Create( AngularTolerance : Real = 1.0e-4 ) |
44 | returns CompBezierCurves2dToBSplineCurve2d from Convert; |
45 | ---Purpose: Constructs a framework for converting a sequence of |
46 | -- adjacent non-rational Bezier curves into a BSpline curve. |
47 | -- Knots will be created on the computed BSpline curve at |
48 | -- each junction point of two consecutive Bezier curves. The |
49 | -- degree of continuity of the BSpline curve will be increased at |
50 | -- the junction point of two consecutive Bezier curves if their |
51 | -- tangent vectors at this point are parallel. AngularTolerance |
52 | -- (given in radians, and defaulted to 1.0 e-4) will be used |
53 | -- to check the parallelism of the two tangent vectors. |
54 | -- Use the following functions: |
55 | -- - AddCurve to define in sequence the adjacent Bezier |
56 | -- curves to be converted, |
57 | -- - Perform to compute the data needed to build the BSpline curve, |
58 | -- - and the available consultation functions to access the |
59 | -- computed data. This data may be used to construct the BSpline curve. |
60 | |
61 | AddCurve( me : in out; |
62 | Poles : Array1OfPnt2d from TColgp) |
63 | is static; |
64 | --- Purpose: Adds the Bezier curve defined by the table of poles Poles, to |
65 | -- the sequence (still contained in this framework) of adjacent |
66 | -- Bezier curves to be converted into a BSpline curve. |
67 | -- Only polynomial (i.e. non-rational) Bezier curves are |
68 | -- converted using this framework. |
69 | -- If this is not the first call to the function (i.e. if this framework |
70 | -- still contains data in its sequence of Bezier curves), the |
71 | -- degree of continuity of the BSpline curve will be increased at |
72 | -- the time of computation at the first point of the added Bezier |
73 | -- curve (i.e. the first point of the Poles table). This will be the |
74 | -- case if the tangent vector of the curve at this point is |
75 | -- parallel to the tangent vector at the end point of the |
76 | -- preceding Bezier curve in the sequence of Bezier curves still |
77 | -- contained in this framework. An angular tolerance given at |
78 | -- the time of construction of this framework, will be used to |
79 | -- check the parallelism of the two tangent vectors. This |
80 | -- checking procedure, and all the relative computations will be |
81 | -- performed by the function Perform. |
82 | -- When the sequence of adjacent Bezier curves is complete, |
83 | -- use the following functions: |
84 | -- - Perform to compute the data needed to build the BSpline curve, |
85 | -- - and the available consultation functions to access the |
86 | -- computed data. This data may be used to construct the BSpline curve. |
87 | -- Warning |
88 | -- The sequence of Bezier curves treated by this framework is |
89 | -- automatically initialized with the first Bezier curve when the |
90 | -- function is first called. During subsequent use of this function, |
91 | -- ensure that the first point of the added Bezier curve (i.e. the |
92 | -- first point of the Poles table) is coincident with the last point |
93 | -- of the sequence (i.e. the last point of the preceding Bezier |
94 | -- curve in the sequence) of Bezier curves still contained in |
95 | -- this framework. An error may occur at the time of |
96 | -- computation if this condition is not satisfied. Particular care |
97 | -- must be taken with respect to the above, as this condition is |
98 | -- not checked either when defining the sequence of Bezier |
99 | -- curves or at the time of computation. |
100 | |
101 | |
102 | Perform(me: in out) |
103 | ---Purpose: Computes all the data needed to build a BSpline curve |
104 | -- equivalent to the sequence of adjacent Bezier curves still |
105 | -- contained in this framework. |
106 | -- A knot is inserted on the computed BSpline curve at the |
107 | -- junction point of two consecutive Bezier curves. The |
108 | -- degree of continuity of the BSpline curve will be increased |
109 | -- at the junction point of two consecutive Bezier curves if |
110 | -- their tangent vectors at this point are parallel. An angular |
111 | -- tolerance given at the time of construction of this |
112 | -- framework is used to check the parallelism of the two |
113 | -- tangent vectors. |
114 | -- Use the available consultation functions to access the |
115 | -- computed data. This data may then be used to construct |
116 | -- the BSpline curve. |
117 | -- Warning |
118 | -- Ensure that the curves in the sequence of Bezier curves |
119 | -- contained in this framework are adjacent. An error may |
120 | -- occur at the time of computation if this condition is not |
121 | -- satisfied. Particular care must be taken with respect to the |
122 | -- above as this condition is not checked, either when |
123 | -- defining the Bezier curve sequence or at the time of computation. |
124 | is static; |
125 | |
126 | |
127 | Degree(me) returns Integer from Standard |
128 | is static; |
129 | ---Purpose: Returns the degree of the BSpline curve whose data is |
130 | -- computed in this framework. |
131 | -- Warning |
132 | -- Take particular care not to use this function before the |
133 | -- computation is performed (Perform function), as this |
134 | -- condition is not checked and an error may therefore occur. |
135 | |
136 | NbPoles(me) returns Integer from Standard |
137 | is static; |
138 | ---Purpose: Returns the number of poles of the BSpline curve whose |
139 | -- data is computed in this framework. |
140 | -- Warning |
141 | -- Take particular care not to use this function before the |
142 | -- computation is performed (Perform function), as this |
143 | -- condition is not checked and an error may therefore occur. |
144 | |
145 | Poles(me; Poles : in out Array1OfPnt2d from TColgp) |
146 | is static; |
147 | --- Purpose: Loads the Poles table with the poles of the BSpline curve |
148 | -- whose data is computed in this framework. |
149 | -- Warning |
150 | -- - Do not use this function before the computation is |
151 | -- performed (Perform function). |
152 | -- - The length of the Poles array must be equal to the |
153 | -- number of poles of the BSpline curve whose data is |
154 | -- computed in this framework. |
155 | -- Particular care must be taken with respect to the above, as |
156 | -- these conditions are not checked, and an error may occur. |
157 | |
158 | NbKnots(me) returns Integer from Standard |
159 | is static; |
160 | --- Purpose: Returns the number of knots of the BSpline curve whose |
161 | -- data is computed in this framework. |
162 | -- Warning |
163 | -- Take particular care not to use this function before the |
164 | -- computation is performed (Perform function), as this |
165 | -- condition is not checked and an error may therefore occur. |
166 | |
167 | KnotsAndMults(me; |
168 | Knots : in out Array1OfReal from TColStd; |
169 | Mults : in out Array1OfInteger from TColStd) |
170 | is static; |
171 | --- Purpose: Loads the Knots table with the knots |
172 | -- and the Mults table with the corresponding multiplicities |
173 | -- of the BSpline curve whose data is computed in this framework. |
174 | -- Warning |
175 | -- - Do not use this function before the computation is |
176 | -- performed (Perform function). |
177 | -- - The length of the Knots and Mults arrays must be equal |
178 | -- to the number of knots in the BSpline curve whose data is |
179 | -- computed in this framework. |
180 | -- Particular care must be taken with respect to the above as |
181 | -- these conditions are not checked, and an error may occur. |
182 | |
183 | |
184 | fields |
185 | mySequence : SequenceOfArray1OfPoles2d from Convert; |
186 | CurvePoles : SequenceOfPnt2d from TColgp; |
187 | CurveKnots : SequenceOfReal from TColStd; |
188 | KnotsMultiplicities : SequenceOfInteger from TColStd; |
189 | myDegree : Integer from Standard; |
190 | myAngular : Real from Standard; |
191 | myDone : Boolean from Standard; |
192 | |
193 | end CompBezierCurves2dToBSplineCurve2d; |