7fd59977 |
1 | -- File: FairCurve_Batten.cdl |
2 | -- Created: Mon Feb 5 09:34:00 1996 |
3 | -- Author: Philippe MANGIN |
4 | -- <pmn@sgi29> |
5 | ---Copyright: Matra Datavision 1996 |
6 | |
7 | |
8 | class Batten from FairCurve |
9 | |
10 | ---Purpose: Constructs curves with a constant or linearly increasing |
11 | -- section to be used in the design of wooden or plastic |
12 | -- battens. These curves are two-dimensional, and |
13 | -- simulate physical splines or battens. |
14 | |
15 | uses Pnt2d from gp, |
16 | Vec2d from gp, |
17 | BSplineCurve from Geom2d, |
18 | HArray1OfPnt2d from TColgp, |
19 | HArray1OfReal from TColStd, |
20 | HArray1OfInteger from TColStd, |
21 | AnalysisCode from FairCurve |
22 | |
23 | raises NegativeValue, NullValue |
24 | |
25 | is |
26 | Create (P1,P2 : Pnt2d; Height : Real; Slope : Real = 0) |
27 | |
28 | ---Purpose: Constructor with the two points and the geometrical |
29 | -- characteristics of the batten (elastic beam) |
30 | -- Height is the height of the deformation, and Slope is the |
31 | -- slope value, initialized at 0. The user can then supply the |
32 | -- desired slope value by the method, SetSlope. |
33 | -- Other parameters are initialized as follow : |
34 | -- - FreeSliding = False |
35 | -- - ConstraintOrder1 = 1 |
36 | -- - ConstraintOrder2 = 1 |
37 | -- - Angle1 = 0 |
38 | -- - Angle2 = 0 |
39 | -- - SlidingFactor = 1 |
40 | -- Exceptions |
41 | -- NegativeValue if Height is less than or equal to 0. |
42 | -- NullValue if the distance between P1 and P2 is less |
43 | -- than or equal to the tolerance value for distance in |
44 | -- Precision::Confusion: P1.IsEqual(P2, |
45 | -- Precision::Confusion()). The function |
46 | -- gp_Pnt2d::IsEqual tests to see if this is the case. |
47 | returns Batten |
48 | raises NegativeValue, |
49 | NullValue; |
50 | |
51 | Delete(me:out) is virtual; |
52 | ---C++: alias "Standard_EXPORT virtual ~FairCurve_Batten(){Delete();}" |
53 | |
54 | SetFreeSliding (me : in out; FreeSliding : Boolean); |
55 | ---C++: inline |
56 | ---Purpose: Freesliding is initialized with the default setting false. |
57 | -- When Freesliding is set to true and, as a result, sliding |
58 | -- is free, the sliding factor is automatically computed to |
59 | -- satisfy the equilibrium of the batten. |
60 | -- |
61 | SetConstraintOrder1 (me : in out; ConstraintOrder : Integer); |
62 | ---C++: inline |
63 | ---Purpose: Allows you to change the order of the constraint on the |
64 | -- first point. ConstraintOrder has the default setting of 1. |
65 | -- The following settings are available: |
66 | -- - 0-the curve must pass through a point |
67 | -- - 1-the curve must pass through a point and have a given tangent |
68 | -- - 2-the curve must pass through a point, have a given tangent and a given curvature. |
69 | -- The third setting is only valid for |
70 | -- FairCurve_MinimalVariation curves. |
71 | -- These constraints, though geometric, represent the |
72 | -- mechanical constraints due, for example, to the |
73 | -- resistance of the material the actual physical batten is made of. |
74 | |
75 | SetConstraintOrder2 (me : in out; ConstraintOrder : Integer); |
76 | ---C++: inline |
77 | ---Purpose: Allows you to change the order of the constraint on the |
78 | -- second point. ConstraintOrder is initialized with the default setting of 1. |
79 | -- The following settings are available: |
80 | -- - 0-the curve must pass through a point |
81 | -- - 1-the curve must pass through a point and have a given tangent |
82 | -- - 2-the curve must pass through a point, have a given |
83 | -- tangent and a given curvature. |
84 | -- The third setting is only valid for |
85 | -- FairCurve_MinimalVariation curves. |
86 | -- These constraints, though geometric, represent the |
87 | -- mechanical constraints due, for example, to the |
88 | -- resistance of the material the actual physical batten is made of. |
89 | |
90 | SetP1 (me : in out; P1: Pnt2d) |
91 | ---Purpose: Allows you to change the location of the point, P1, and in |
92 | -- doing so, modify the curve. |
93 | -- Warning |
94 | -- This method changes the angle as well as the point. |
95 | -- Exceptions |
96 | -- NullValue if the distance between P1 and P2 is less |
97 | -- than or equal to the tolerance value for distance in |
98 | -- Precision::Confusion: P1.IsEqual(P2, |
99 | -- Precision::Confusion()). The function |
100 | -- gp_Pnt2d::IsEqual tests to see if this is the case. |
101 | raises NullValue; |
102 | |
103 | SetP2 (me : in out; P2: Pnt2d) |
104 | ---Purpose: Allows you to change the location of the point, P1, and in |
105 | -- doing so, modify the curve. |
106 | -- Warning |
107 | -- This method changes the angle as well as the point. |
108 | -- Exceptions |
109 | -- NullValue if the distance between P1 and P2 is less |
110 | -- than or equal to the tolerance value for distance in |
111 | -- Precision::Confusion: P1.IsEqual(P2, |
112 | -- Precision::Confusion()). The function |
113 | -- gp_Pnt2d::IsEqual tests to see if this is the case. |
114 | raises NullValue; |
115 | |
116 | SetAngle1(me : in out; Angle1 : Real); |
117 | ---C++: inline |
118 | ---Purpose: Allows you to change the angle Angle1 at the first point, |
119 | -- P1. The default setting is 0. |
120 | -- |
121 | SetAngle2 (me : in out; Angle2 : Real); |
122 | ---C++: inline |
123 | ---Purpose: Allows you to change the angle Angle2 at the second |
124 | -- point, P2. The default setting is 0. |
125 | -- |
126 | SetHeight (me : in out; Height : Real) |
127 | ---C++: inline |
128 | ---Purpose: Allows you to change the height of the deformation. |
129 | -- Raises NegativeValue; -- if Height <= 0 |
130 | raises NegativeValue; -- if Height <= 0 |
131 | |
132 | SetSlope (me : in out; Slope : Real); |
133 | ---C++: inline |
134 | ---Purpose: Allows you to set the slope value, Slope. |
135 | |
136 | SetSlidingFactor(me : in out ; SlidingFactor : Real); |
137 | ---C++: inline |
138 | ---Purpose: Allows you to change the ratio SlidingFactor. This |
139 | -- compares the length of the batten and the reference |
140 | -- length, which is, in turn, a function of the constraints. |
141 | -- This modification has one of the following two effects: |
142 | -- - if you increase the value, it inflates the batten |
143 | -- - if you decrease the value, it flattens the batten. |
144 | -- When sliding is free, the sliding factor is automatically |
145 | -- computed to satisfy the equilibrium of the batten. When |
146 | -- sliding is imposed, a value is required for the sliding factor. |
147 | -- SlidingFactor is initialized with the default setting of 1. |
148 | |
149 | Compute (me :in out; |
150 | Code : in out AnalysisCode; |
151 | NbIterations : Integer = 50; |
152 | Tolerance : Real = 1.0e-3 ) |
153 | ---Purpose: Performs the algorithm, using the arguments Code, |
154 | -- NbIterations and Tolerance and computes the curve |
155 | -- with respect to the constraints. |
156 | -- Code will have one of the following values: |
157 | -- - OK |
158 | -- - NotConverged |
159 | -- - InfiniteSliding |
160 | -- - NullHeight |
161 | -- The parameters Tolerance and NbIterations control |
162 | -- how precise the computation is, and how long it will take. |
163 | |
164 | returns Boolean |
165 | is virtual; |
166 | |
167 | Compute (me :in out; |
168 | DeltaP1 : Vec2d; |
169 | DeltaP2 : Vec2d; |
170 | DeltaAngle1 : Real; |
171 | DeltaAngle2 : Real; |
172 | ACode : in out AnalysisCode; |
173 | NbIterations : Integer; |
174 | Tolerance: Real ) |
175 | ---Purpose: compute the curve with respect of the delta-constraints. |
176 | returns Boolean is private; |
177 | |
178 | SlidingOfReference(me) returns Real; |
179 | ---Purpose: Computes the real number value for length Sliding of |
180 | -- Reference for new constraints. If you want to give a |
181 | -- specific length to a batten curve, use the following |
182 | -- syntax: b.SetSlidingFactor(L / |
183 | -- b.SlidingOfReference()) where b is the |
184 | -- name of the batten curve object. |
185 | |
186 | SlidingOfReference(me; D, A1, A2 : Real) returns Real is protected; |
187 | Compute(me; D, A1, A2 : Real) returns Real is protected; |
188 | Compute(me; D, A : Real) returns Real is protected; |
189 | -- |
190 | -- Selector Methods --------------------------------------- |
191 | -- |
192 | ---Purpose: Returns the effective geometrical constraints at the |
193 | -- last batten computation. This effectives values may |
194 | -- be not equal with the wanted values if |
195 | -- - if the value is "free" |
196 | -- - in the case of incomplete computation : collapse, |
197 | -- infinite sliding, height of batten will be negative at end points |
198 | |
199 | GetFreeSliding (me) |
200 | ---C++: inline |
201 | ---Purpose: Returns the initial free sliding value, false by default. |
202 | -- Free sliding is generally more aesthetically pleasing |
203 | -- than constrained sliding. However, the computation can |
204 | -- fail with values such as angles greater than PI/2. This is |
205 | -- because the resulting batten length is theoretically infinite. |
206 | returns Boolean; |
207 | |
208 | GetConstraintOrder1 (me) |
209 | ---C++: inline |
210 | ---Purpose: Returns the established first constraint order. |
211 | returns Integer; |
212 | |
213 | GetConstraintOrder2 (me) |
214 | ---C++: inline |
215 | ---Purpose: Returns the established second constraint order. |
216 | returns Integer; |
217 | |
218 | GetP1 (me) |
219 | ---C++: inline |
220 | ---C++: return const& |
221 | ---Purpose: Returns the established location of the point P1. |
222 | returns Pnt2d; |
223 | |
224 | GetP2 (me) |
225 | ---C++: inline |
226 | ---C++: return const& |
227 | ---Purpose: Returns the established location of the point P2. |
228 | returns Pnt2d; |
229 | |
230 | GetAngle1 (me) |
231 | ---C++: inline |
232 | ---Purpose: Returns the established first angle. |
233 | returns Real; |
234 | |
235 | GetAngle2 (me) |
236 | ---C++: inline |
237 | ---Purpose: Returns the established second angle. |
238 | returns Real; |
239 | |
240 | GetHeight (me) |
241 | ---C++: inline |
242 | ---Purpose: Returns the thickness of the lathe. |
243 | returns Real; |
244 | |
245 | GetSlope (me) |
246 | ---C++: inline |
247 | ---Purpose: Returns the established slope value. |
248 | returns Real; |
249 | |
250 | GetSlidingFactor(me) |
251 | ---C++: inline |
252 | ---Purpose: Returns the initial sliding factor. |
253 | returns Real; |
254 | -- |
255 | -- result methods ------------------------------------------- |
256 | -- |
257 | Curve(me) |
258 | ---Purpose: Returns the computed curve a 2d BSpline. |
259 | returns BSplineCurve; |
260 | |
261 | Dump(me ; o : in out OStream) is virtual; |
262 | ---Purpose: Prints on the stream o information on the current state |
263 | -- of the object. |
264 | --- |
265 | --- Private methodes -------------------------------------- |
266 | --- |
267 | |
268 | Angles(me : in out; P1, P2 : Pnt2d) is private; |
269 | |
270 | fields |
271 | myCode : AnalysisCode from FairCurve is protected; |
272 | --- parameter of current Batten |
273 | OldP1, OldP2 : Pnt2d is protected; |
274 | OldAngle1, OldAngle2 : Real is protected; |
275 | OldHeight, OldSlope : Real is protected; |
276 | OldSlidingFactor : Real is protected; |
277 | |
278 | OldFreeSliding : Boolean is protected; |
279 | OldConstraintOrder1, OldConstraintOrder2 : Integer is protected; |
280 | |
281 | NewP1, NewP2 : Pnt2d is protected; |
282 | NewAngle1, NewAngle2 : Real is protected; |
283 | NewHeight, NewSlope : Real is protected; |
284 | NewSlidingFactor : Real is protected; |
285 | |
286 | --- parameter of next Batten |
287 | NewFreeSliding : Boolean is protected; |
288 | NewConstraintOrder1, NewConstraintOrder2 : Integer is protected; |
289 | |
290 | --- BSpline definition |
291 | |
292 | Degree : Integer is protected; |
293 | Poles : HArray1OfPnt2d from TColgp is protected; |
294 | Flatknots : HArray1OfReal from TColStd is protected; |
295 | Knots : HArray1OfReal from TColStd is protected; |
296 | Mults : HArray1OfInteger from TColStd is protected; |
297 | |
298 | end Batten; |