1 -- Created on: 1996-08-09
2 -- Created by: Herve LOUESSARD
3 -- Copyright (c) 1996-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.
22 class CurveContinuity from LocalAnalysis
25 -- This class gives tools to check local continuity C0
26 -- C1 C2 G1 G2 between two points situated on two curves
30 Boolean, Integer, Real from Standard,
32 CLProps from GeomLProp,
33 StatusErrorType from LocalAnalysis
41 Create( Curv1: Curve from Geom; u1: Real from Standard;
42 Curv2: Curve from Geom; u2: Real from Standard;
43 Order: Shape from GeomAbs;
44 EpsNul: Real from Standard= 0.001;
45 EpsC0 : Real from Standard= 0.001;
46 EpsC1 : Real from Standard= 0.001;
47 EpsC2 : Real from Standard= 0.001;
48 EpsG1 : Real from Standard= 0.001;
49 EpsG2 : Real from Standard= 0.001;
50 Percent :Real from Standard= 0.01;
51 Maxlen: Real from Standard =10000)
54 -- -u1 is the parameter of the point on Curv1
55 -- -u2 is the parameter of the point on Curv2
56 -- -Order is the required continuity:
57 -- GeomAbs_C0 GeomAbs_C1 GeomAbs_C2
58 -- GeomAbs_G1 GeomAbs_G2
60 -- -EpsNul is used to detect a a vector with nul
63 -- -EpsC0 is used for C0 continuity to confuse two
66 -- -EpsC1 is an angular tolerance in radians used
67 -- for C1 continuity to compare the angle between
68 -- the first derivatives
70 -- -EpsC2 is an angular tolerance in radians used
71 -- for C2 continuity to compare the angle between
72 -- the second derivatives
74 -- -EpsG1 is an angular tolerance in radians used
75 -- for G1 continuity to compare the angle between
78 -- -EpsG2 is an angular tolerance in radians used
79 -- for G2 continuity to compare the angle between
82 -- - percent : percentage of curvature variation (unitless)
83 -- used for G2 continuity
85 -- - Maxlen is the maximum length of Curv1 or Curv2 in
86 -- meters used to detect nul curvature (in mm)
91 -- the constructor computes the quantities which are
92 -- necessary to check the continuity in the following cases:
96 -- - the distance between P1 and P2 with P1=Curv1 (u1) and
102 -- - the angle between the first derivatives
103 -- dCurv1(u1) dCurv2(u2)
104 -- -------- and ---------
107 -- - the ratio between the magnitudes of the first
110 -- the angle value is between 0 and PI/2
114 -- - the angle between the second derivatives
116 -- d Curv1(u1) d Curv2(u2)
117 -- ---------- ----------
121 -- the angle value is between 0 and PI/2
123 -- - the ratio between the magnitudes of the second
128 -- the angle between the tangents at each point
130 -- the angle value is between 0 and PI/2
134 -- -the angle between the normals at each point
136 -- the angle value is between 0 and PI/2
138 -- - the relative variation of curvature:
140 -- ------------------
144 -- where curvat1 is the curvature at the first point
145 -- and curvat2 the curvature at the second point
147 returns CurveContinuity from LocalAnalysis;
150 IsDone(me) returns Boolean from Standard;
151 -- returns true if there is no problem in the constructor
154 StatusError(me) returns StatusErrorType from LocalAnalysis;
155 -- returns the error status:
156 -- NullFirstDerivative : one (or both) first derivative is null
157 -- NullSecondDerivative: one (or both) second derivative is null
158 -- TangentNotDefined: one (or both) tangent is undefined
159 -- NormalNotDefined: one (or both) normal is undefined
162 ContinuityStatus (me) returns Shape from GeomAbs raises NotDone ;
163 -- returns the continuity required in the constructor
168 -- The following functions return the quantities
169 -- which are necessary to check continuity
171 C0Value(me) returns Real from Standard raises NotDone ;
172 -- returns the distance between P1 and P2 with P1=Curv1 (u1) and
175 C1Angle(me) returns Real from Standard raises NotDone ;
176 -- returns the angle between the first derivatives :
177 -- dCurv1(u1) dCurv2(u2)
178 -- -------- and ---------
181 -- the angle value is 0 and PI/2
183 C1Ratio(me) returns Real from Standard raises NotDone ;
184 -- returns the ratio between the magnitudes of the first
185 -- derivatives dCurv1(u1) dCurv2(u2)
186 -- -------- and ---------
189 C2Angle(me) returns Real from Standard raises NotDone ;
190 -- returns the angle between the second derivatives
192 -- d Curv1(u1) d Curv2(u2)
193 -- ---------- and ----------
197 -- the angle value is between 0 and PI/2
199 C2Ratio(me) returns Real from Standard raises NotDone;
200 -- returns the ratio between the magnitudes of the second
202 -- d Curv1(u1) d Curv2(u2)
203 -- ---------- and ----------
208 G1Angle(me) returns Real from Standard raises NotDone ;
209 -- returns the angle between the tangents at each point
210 -- the angle value is between 0 and PI/2
212 G2Angle(me) returns Real from Standard raises NotDone ;
213 -- returns the angle between the normals at each point
214 -- the angle value is between 0 and PI/2
216 G2CurvatureVariation(me) returns Real from Standard raises NotDone;
217 -- returns the relative variation of curvature
221 -- the following functions check the local continuity and return
222 -- true if the required continuity is satisfied :
224 IsC0(me) returns Boolean from Standard
226 -- returns true if the local continuity is C0 that is :
227 -- C0Value(me) < EpsC0
231 IsC1(me) returns Boolean from Standard
233 -- returns true if the local continuity is C1 that is :
234 -- C0Value(me) < EpsC0
235 -- C1Angle(me) < EpsC1
238 IsC2(me) returns Boolean from Standard
240 -- returns true if the local continuity is C2 that is :
241 -- C0Value(me) < EpsC0 ,
242 -- C1Angle(me) < EpsC1
243 -- C2Angle (me) < EpsC2 and
244 -- C2Ratio is the square of C1Ratio up to a tolerance
248 IsG1(me) returns Boolean from Standard
250 -- returns true is the local continuity is G1 that is
251 -- C0Value(me) < EpsC0 and
252 -- G1Angle(me)< EpsG1
255 IsG2(me) returns Boolean from Standard
257 -- returns true if the local continuity is G2 that is
258 -- C0Value(me) < EpsC0,
259 -- G1Angle(me) < EpsG1
260 -- G2Angle(me) < EpsG2
261 -- G2CurvatureVariation < percent
265 -- The following function are private and used in the constructor
267 CurvC0(me:in out; Curv1, Curv2 : out CLProps from GeomLProp)is private;
268 CurvC1(me:in out; Curv1, Curv2 : out CLProps from GeomLProp ) is private;
269 CurvC2(me :in out ; Curv1, Curv2 : out CLProps from GeomLProp)is private;
271 CurvG1(me:in out; Curv1, Curv2 :out CLProps from GeomLProp ) is private ;
273 CurvG2(me:in out; Curv1, Curv2 :out CLProps from GeomLProp)is private ;
279 myContC0 : Real from Standard;
280 myContC1 : Real from Standard;
281 myContC2 : Real from Standard;
282 myContG1 : Real from Standard;
283 myContG2 : Real from Standard;
284 myCourbC1 : Real from Standard;
285 myCourbC2 : Real from Standard;
286 myG2Variation : Real from Standard;
287 myLambda1 : Real from Standard;
288 myLambda2 : Real from Standard;
289 myTypeCont : Shape from GeomAbs;
290 myepsnul : Real from Standard;
291 myepsC0 : Real from Standard;
292 myepsC1 : Real from Standard;
293 myepsC2 : Real from Standard;
294 myepsG1 : Real from Standard;
295 myepsG2 : Real from Standard;
296 myMaxLon : Real from Standard;
297 myperce : Real from Standard;
298 myIsDone : Boolean from Standard;
299 myErrorStatus : StatusErrorType from LocalAnalysis ;