42cf5bc1 |
1 | // Created on: 1996-08-09 |
2 | // Created by: Herve LOUESSARD |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _LocalAnalysis_CurveContinuity_HeaderFile |
18 | #define _LocalAnalysis_CurveContinuity_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
25 | #include <GeomAbs_Shape.hxx> |
26 | #include <Standard_Boolean.hxx> |
27 | #include <LocalAnalysis_StatusErrorType.hxx> |
28 | class StdFail_NotDone; |
29 | class Geom_Curve; |
30 | class GeomLProp_CLProps; |
31 | |
32 | |
33 | |
34 | //! This class gives tools to check local continuity C0 |
35 | //! C1 C2 G1 G2 between two points situated on two curves |
36 | class LocalAnalysis_CurveContinuity |
37 | { |
38 | public: |
39 | |
40 | DEFINE_STANDARD_ALLOC |
41 | |
42 | |
43 | |
44 | //! -u1 is the parameter of the point on Curv1 |
45 | //! -u2 is the parameter of the point on Curv2 |
46 | //! -Order is the required continuity: |
47 | //! GeomAbs_C0 GeomAbs_C1 GeomAbs_C2 |
48 | //! GeomAbs_G1 GeomAbs_G2 |
49 | //! |
50 | //! -EpsNul is used to detect a a vector with nul |
51 | //! magnitude (in mm) |
52 | //! |
53 | //! -EpsC0 is used for C0 continuity to confuse two |
54 | //! points (in mm) |
55 | //! |
56 | //! -EpsC1 is an angular tolerance in radians used |
57 | //! for C1 continuity to compare the angle between |
58 | //! the first derivatives |
59 | //! |
60 | //! -EpsC2 is an angular tolerance in radians used |
61 | //! for C2 continuity to compare the angle between |
62 | //! the second derivatives |
63 | //! |
64 | //! -EpsG1 is an angular tolerance in radians used |
65 | //! for G1 continuity to compare the angle between |
66 | //! the tangents |
67 | //! |
68 | //! -EpsG2 is an angular tolerance in radians used |
69 | //! for G2 continuity to compare the angle between |
70 | //! the normals |
71 | //! |
72 | //! - percent : percentage of curvature variation (unitless) |
73 | //! used for G2 continuity |
74 | //! |
75 | //! - Maxlen is the maximum length of Curv1 or Curv2 in |
76 | //! meters used to detect nul curvature (in mm) |
77 | //! |
78 | //! the constructor computes the quantities which are |
79 | //! necessary to check the continuity in the following cases: |
80 | //! |
81 | //! case C0 |
82 | //! -------- |
83 | //! - the distance between P1 and P2 with P1=Curv1 (u1) and |
84 | //! P2=Curv2(u2) |
85 | //! |
86 | //! case C1 |
87 | //! ------- |
88 | //! |
89 | //! - the angle between the first derivatives |
90 | //! dCurv1(u1) dCurv2(u2) |
91 | //! -------- and --------- |
92 | //! du du |
93 | //! |
94 | //! - the ratio between the magnitudes of the first |
95 | //! derivatives |
96 | //! |
97 | //! the angle value is between 0 and PI/2 |
98 | //! |
99 | //! case C2 |
100 | //! ------- |
101 | //! - the angle between the second derivatives |
102 | //! 2 2 |
103 | //! d Curv1(u1) d Curv2(u2) |
104 | //! ---------- ---------- |
105 | //! 2 2 |
106 | //! du du |
107 | //! |
108 | //! the angle value is between 0 and PI/2 |
109 | //! |
110 | //! - the ratio between the magnitudes of the second |
111 | //! derivatives |
112 | //! |
113 | //! case G1 |
114 | //! ------- |
115 | //! the angle between the tangents at each point |
116 | //! |
117 | //! the angle value is between 0 and PI/2 |
118 | //! |
119 | //! case G2 |
120 | //! ------- |
121 | //! -the angle between the normals at each point |
122 | //! |
123 | //! the angle value is between 0 and PI/2 |
124 | //! |
125 | //! - the relative variation of curvature: |
126 | //! |curvat1-curvat2| |
127 | //! ------------------ |
128 | //! 1/2 |
129 | //! (curvat1*curvat2) |
130 | //! |
131 | //! where curvat1 is the curvature at the first point |
132 | //! and curvat2 the curvature at the second point |
133 | Standard_EXPORT LocalAnalysis_CurveContinuity(const Handle(Geom_Curve)& Curv1, const Standard_Real u1, const Handle(Geom_Curve)& Curv2, const Standard_Real u2, const GeomAbs_Shape Order, const Standard_Real EpsNul = 0.001, const Standard_Real EpsC0 = 0.001, const Standard_Real EpsC1 = 0.001, const Standard_Real EpsC2 = 0.001, const Standard_Real EpsG1 = 0.001, const Standard_Real EpsG2 = 0.001, const Standard_Real Percent = 0.01, const Standard_Real Maxlen = 10000); |
134 | |
135 | Standard_EXPORT Standard_Boolean IsDone() const; |
136 | |
137 | Standard_EXPORT LocalAnalysis_StatusErrorType StatusError() const; |
138 | |
139 | Standard_EXPORT GeomAbs_Shape ContinuityStatus() const; |
140 | |
141 | Standard_EXPORT Standard_Real C0Value() const; |
142 | |
143 | Standard_EXPORT Standard_Real C1Angle() const; |
144 | |
145 | Standard_EXPORT Standard_Real C1Ratio() const; |
146 | |
147 | Standard_EXPORT Standard_Real C2Angle() const; |
148 | |
149 | Standard_EXPORT Standard_Real C2Ratio() const; |
150 | |
151 | Standard_EXPORT Standard_Real G1Angle() const; |
152 | |
153 | Standard_EXPORT Standard_Real G2Angle() const; |
154 | |
155 | Standard_EXPORT Standard_Real G2CurvatureVariation() const; |
156 | |
157 | Standard_EXPORT Standard_Boolean IsC0() const; |
158 | |
159 | Standard_EXPORT Standard_Boolean IsC1() const; |
160 | |
161 | Standard_EXPORT Standard_Boolean IsC2() const; |
162 | |
163 | Standard_EXPORT Standard_Boolean IsG1() const; |
164 | |
165 | Standard_EXPORT Standard_Boolean IsG2() const; |
166 | |
167 | |
168 | |
169 | |
170 | protected: |
171 | |
172 | |
173 | |
174 | |
175 | |
176 | private: |
177 | |
178 | |
179 | Standard_EXPORT void CurvC0 (GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2); |
180 | |
181 | Standard_EXPORT void CurvC1 (GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2); |
182 | |
183 | Standard_EXPORT void CurvC2 (GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2); |
184 | |
185 | Standard_EXPORT void CurvG1 (GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2); |
186 | |
187 | Standard_EXPORT void CurvG2 (GeomLProp_CLProps& Curv1, GeomLProp_CLProps& Curv2); |
188 | |
189 | |
190 | Standard_Real myContC0; |
191 | Standard_Real myContC1; |
192 | Standard_Real myContC2; |
193 | Standard_Real myContG1; |
194 | Standard_Real myContG2; |
195 | Standard_Real myCourbC1; |
196 | Standard_Real myCourbC2; |
197 | Standard_Real myG2Variation; |
198 | Standard_Real myLambda1; |
199 | Standard_Real myLambda2; |
200 | GeomAbs_Shape myTypeCont; |
201 | Standard_Real myepsnul; |
202 | Standard_Real myepsC0; |
203 | Standard_Real myepsC1; |
204 | Standard_Real myepsC2; |
205 | Standard_Real myepsG1; |
206 | Standard_Real myepsG2; |
207 | Standard_Real myMaxLon; |
208 | Standard_Real myperce; |
209 | Standard_Boolean myIsDone; |
210 | LocalAnalysis_StatusErrorType myErrorStatus; |
211 | |
212 | |
213 | }; |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | |
220 | |
221 | #endif // _LocalAnalysis_CurveContinuity_HeaderFile |