b311480e |
1 | // Created on: 2002-10-11 |
2 | // Created by: Michael KUZMITCHEV |
3 | // Copyright (c) 2002-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
9 | // |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | // |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | |
1cd84fee |
22 | #include <QABugs.hxx> |
7fd59977 |
23 | |
24 | #include <Draw_Interpretor.hxx> |
25 | #include <DBRep.hxx> |
26 | #include <DrawTrSurf.hxx> |
27 | #include <AIS_InteractiveContext.hxx> |
28 | #include <ViewerTest.hxx> |
29 | #include <AIS_Shape.hxx> |
30 | #include <TopoDS_Shape.hxx> |
31 | |
32 | #include <TColgp_Array1OfPnt.hxx> |
33 | #include <TColStd_Array1OfReal.hxx> |
34 | #include <TColStd_Array1OfInteger.hxx> |
35 | #include <Geom_BSplineCurve.hxx> |
36 | #include <Geom_Line.hxx> |
37 | #include <Geom_TrimmedCurve.hxx> |
38 | #include <GeomAPI_ExtremaCurveCurve.hxx> |
39 | |
40 | const Standard_Integer Glob_NbPoles = 195; |
41 | const Standard_Real Glob_Poles[Glob_NbPoles][3] = |
42 | { |
43 | { 60000, 31.937047503393231, 799.36226142892554 }, |
44 | { 60000.000000027772, 16.712487623992825, 799.97053069028755 }, |
45 | { 59999.999999875639, 7.3723603687660546, 799.97042131653711 }, |
46 | { 60000.000000331296, 1.2070383839533065, 799.90534456032105 }, |
47 | { 59999.999999361171, -2.5807810139032785, 799.77442818789041 }, |
48 | { 60000.000000952597, -4.7405254527655112, 799.70146419719595 }, |
49 | { 59999.999998867599, -5.3922917628932563, 799.62943054158143 }, |
50 | { 60000.000001091154, -5.1399175234965044, 799.63364074172011 }, |
51 | { 59999.999999142601, -3.6992503431468067, 799.67179299415568 }, |
52 | { 60000.000000546061, -1.6910663098148713, 799.76799688166773 }, |
53 | { 59999.999999725333, 1.1886267067330731, 799.91818018455035 }, |
54 | { 60000.000000101914, 4.5979596894282677, 800.11782874041273 }, |
55 | { 59999.999999977204, 8.5921385739756673, 800.36980220999453 }, |
56 | { 60000.000000018619, 16.600658956791417, 800.90755378048414 }, |
57 | { 59999.999999985768, 26.040687605616604, 801.59827916977554 }, |
58 | { 60000.000000052918, 30.448324872994441, 801.9310695501531 }, |
59 | { 59999.999999883308, 35.089921752286457, 802.29194004854389 }, |
60 | { 60000.000000186978, 39.947755013962528, 802.68007678107051 }, |
61 | { 59999.99999976845, 45.005892525213071, 803.09465896567826 }, |
62 | { 60000.000000227068, 50.249778854659326, 803.53486876081706 }, |
63 | { 59999.999999821659, 55.665932960782108, 803.9998957687626 }, |
64 | { 60000.000000112479, 61.241734208767859, 804.48893829648762 }, |
65 | { 59999.999999943684, 66.965272918611916, 805.00120177704798 }, |
66 | { 60000.000000021486, 72.8252416954995, 805.53589657709654 }, |
67 | { 59999.99999999431, 78.810843745189473, 806.09223572876306 }, |
68 | { 60000.000000004045, 87.962119756404547, 806.95803383418911 }, |
69 | { 59999.99999999725, 97.349976765262795, 807.869010426567 }, |
70 | { 60000.000000017491, 100.50428991828356, 808.17759139897635 }, |
71 | { 59999.99999994829, 103.68239055379394, 808.49099684342912 }, |
72 | { 60000.000000105072, 106.88305649144334, 808.80912918631941 }, |
73 | { 59999.999999835563, 110.10508187457555, 809.13189073948308 }, |
74 | { 60000.000000207947, 113.34727572158297, 809.45918381767103 }, |
75 | { 59999.999999784653, 116.60846040037053, 809.79091039912782 }, |
76 | { 60000.000000180742, 119.88747020406682, 810.12697237079749 }, |
77 | { 59999.999999880296, 123.18314981484644, 810.46727114678265 }, |
78 | { 60000.000000059626, 126.49435287223255, 810.81170785335109 }, |
79 | { 59999.999999979838, 129.81994045902351, 811.16018308253979 }, |
80 | { 60000.000000015229, 134.8281992328765, 811.68880383859914 }, |
81 | { 59999.99999998945, 139.86373510893441, 812.2260602582727 }, |
82 | { 60000.000000059066, 141.54513692067022, 812.40609267860532 }, |
83 | { 59999.999999845008, 143.22928798266199, 812.58705944070834 }, |
84 | { 60000.000000278043, 144.91604799540772, 812.7689478797023 }, |
85 | { 59999.999999621934, 146.60527693312631, 812.95174532592102 }, |
86 | { 60000.000000407505, 148.29683501034282, 813.13543899059755 }, |
87 | { 59999.999999644526, 149.99058265886663, 813.32001613307352 }, |
88 | { 60000.000000252723, 151.68638048575326, 813.5054638442823 }, |
89 | { 59999.999999853622, 153.38408925794459, 813.69176926621947 }, |
90 | { 60000.000000068765, 155.08356985703421, 813.87891939578799 }, |
91 | { 59999.999999973967, 156.7846832610312, 814.06690122038856 }, |
92 | { 60000.00000002468, 159.33859412935516, 814.35010184114628 }, |
93 | { 59999.999999977736, 161.89555354531564, 814.63511466528189 }, |
94 | { 60000.000000145039, 162.74819471256941, 814.73031865086841 }, |
95 | { 59999.999999608634, 163.60113987644607, 814.82572069112655 }, |
96 | { 60000.000000709108, 164.45437167903589, 814.92131914784375 }, |
97 | { 59999.999999031643, 165.3078727497936, 815.0171123286641 }, |
98 | { 60000.000001042623, 166.16162573916125, 815.11309861889924 }, |
99 | { 59999.999999097396, 167.01561326831904, 815.20927628960794 }, |
100 | { 60000.000000630716, 167.86981798631649, 815.30564372626975 }, |
101 | { 59999.999999648215, 168.72422251240596, 815.40219920078994 }, |
102 | { 60000.000000151289, 169.57880948189478, 815.4989410625825 }, |
103 | { 59999.999999954052, 170.43356151298337, 815.5958676029403 }, |
104 | { 60000.000000034408, 171.71591108030151, 815.74153190228753 }, |
105 | { 59999.999999976135, 172.9985538007256, 815.88760410128577 }, |
106 | { 60000.000000129759, 173.42613177350728, 815.93633994702668 }, |
107 | { 59999.999999664251, 173.85373796967124, 815.98512067846866 }, |
108 | { 60000.00000060827, 174.28137021936112, 816.03394612011459 }, |
109 | { 59999.99999914426, 174.70902633885802, 816.08281598496671 }, |
110 | { 60000.000000969369, 175.13670416564241, 816.13173017155248 }, |
111 | { 59999.999999107844, 175.56440150794049, 816.18068832455049 }, |
112 | { 60000.00000066567, 175.9921162052986, 816.22969037578832 }, |
113 | { 59999.999999602165, 176.41984606692156, 816.27873598355484 }, |
114 | { 60000.00000018561, 176.84758892491178, 816.3278250228899 }, |
115 | { 59999.999999935775, 177.27534259516338, 816.37695722529566 }, |
116 | { 60000.000000054533, 177.91698605475608, 816.45071998561696 }, |
117 | { 59999.999999955864, 178.55864403901305, 816.52457892469988 }, |
118 | { 60000.000000281914, 178.7725313764083, 816.54920923644852 }, |
119 | { 59999.999999214248, 178.98641977813006, 816.57385016025694 }, |
120 | { 60000.000001492997, 179.20030898752373, 816.59850173903158 }, |
121 | { 59999.999997853804, 179.41419870083473, 816.62316380941468 }, |
122 | { 60000.000002424618, 179.62808869307457, 816.647836551757 }, |
123 | { 59999.999997816361, 179.84197863289955, 816.6725196831527 }, |
124 | { 60000.000001566797, 180.05586830671322, 816.69721343479125 }, |
125 | { 59999.999999121159, 180.26975739282756, 816.72191756454924 }, |
126 | { 60000.00000036486, 180.48364565146377, 816.74663219124841 }, |
127 | { 59999.999999904954, 180.69753279192835, 816.7713572079532 }, |
128 | { 60000.000000054562, 181.0183614269956, 816.8084603269557 }, |
129 | { 59999.999999978463, 181.33918632988278, 816.84558675379014 }, |
130 | { 60000.000000049782, 181.44612751539663, 816.85796481705847 }, |
131 | { 59999.999999914071, 181.55306821881811, 816.87034546240886 }, |
132 | { 60000.000000125139, 181.66000840292782, 816.88272868833144 }, |
133 | { 59999.999999843392, 181.76694804030186, 816.89511449082431 }, |
134 | { 60000.000000167289, 181.87388708628473, 816.90750286566583 }, |
135 | { 59999.999999847467, 181.98082551962966, 816.9198938103757 }, |
136 | { 60000.000000119864, 182.08776329350809, 816.93228732197861 }, |
137 | { 59999.999999917491, 182.19470038386558, 816.94468339453306 }, |
138 | { 60000.000000050633, 182.30163675019068, 816.9570820285785 }, |
139 | { 59999.999999972366, 182.40857236133851, 816.96948321649302 }, |
140 | { 60000.000000032509, 182.56897459276843, 816.98808882907122 }, |
141 | { 59999.999999965934, 182.7293749693155, 817.00670017517837 }, |
142 | { 60000.000000238462, 182.78284155215263, 817.01290459816312 }, |
143 | { 59999.999999345615, 182.83630791626743, 817.01910964099045 }, |
144 | { 60000.00000119608, 182.88977407140584, 817.02531535916364 }, |
145 | { 59999.999998362182, 182.94323998619015, 817.03152164472851 }, |
146 | { 60000.000001757064, 182.99670569682132, 817.03772865736005 }, |
147 | { 59999.999998499035, 183.05017115047181, 817.04393620474377 }, |
148 | { 60000.00000101691, 183.10363639052409, 817.05014447471717 }, |
149 | { 59999.999999469313, 183.15710137432194, 817.05635331513508 }, |
150 | { 60000.000000196254, 183.21056612270786, 817.06256282498509 }, |
151 | { 59999.999999961823, 183.26403061846696, 817.06877295237007 }, |
152 | { 60000.000000031148, 183.37095910597188, 817.0811944807366 }, |
153 | { 59999.999999975873, 183.47788656385964, 817.09361853568328 }, |
154 | { 60000.000000078871, 183.53291535756762, 817.10001332133618 }, |
155 | { 59999.999999822408, 183.57465447580566, 817.10486251586156 }, |
156 | { 60000.000000306398, 183.67093862701302, 817.11605868308925 }, |
157 | { 59999.999999580868, 183.62493711493508, 817.11070057755603 }, |
158 | { 60000.000000457883, 183.83983154073323, 817.13569840343439 }, |
159 | { 59999.999999600586, 183.70298550843307, 817.11977179379392 }, |
160 | { 60000.000000274122, 183.92091406059222, 817.14512405357789 }, |
161 | { 59999.999999859414, 183.87191278066462, 817.13941945054194 }, |
162 | { 60000.000000045809, 183.96882854112027, 817.15069318206758 }, |
163 | { 59999.99999999682, 184.01172713386404, 817.15568252551441 }, |
164 | { 60000.000000002117, 199.05860625274244, 818.90605990894926 }, |
165 | { 60000.000000011685, 213.77441984052732, 820.66779572748067 }, |
166 | { 59999.999999945896, 228.63273752574398, 822.50191665906459 }, |
167 | { 60000.000000137385, 243.60930053773387, 824.4160390659564 }, |
168 | { 59999.999999745312, 257.44864608947171, 826.20557537898253 }, |
169 | { 60000.000000371336, 272.37732017567259, 828.28374145687258 }, |
170 | { 59999.999999564294, 283.4609507719199, 829.76911975631128 }, |
171 | { 60000.000000411754, 297.87730027160165, 831.94635758332913 }, |
172 | { 59999.999999691667, 308.39894455125989, 833.48120705572103 }, |
173 | { 60000.000000175751, 321.04689540263291, 835.47802201470222 }, |
174 | { 59999.999999930937, 332.7974681685576, 837.36295119087083 }, |
175 | { 60000.000000012922, 344.23852019267594, 839.26003269871717 }, |
176 | { 59999.999999978521, 380.87159046869039, 845.50264944092885 }, |
177 | { 60000.000000031927, 417.67053058140004, 852.32838657260925 }, |
178 | { 59999.999999895757, 443.71876268540638, 857.33613824789597 }, |
179 | { 60000.00000023668, 470.42282907220516, 863.40925211937144 }, |
180 | { 59999.999999591026, 506.36442771103123, 868.70489233101273 }, |
181 | { 60000.000000559063, 504.29569767668107, 873.82665736030435 }, |
182 | { 59999.999999387175, 618.22680165126303, 889.69085497467483 }, |
183 | { 60000.00000054048, 520.96760954336719, 878.60259543512541 }, |
184 | { 59999.999999620944, 695.15397128954748, 909.33199431749756 }, |
185 | { 60000.000000202854, 652.21259368585868, 902.32746593221361 }, |
186 | { 59999.999999925931, 713.31441817738153, 914.25671409207371 }, |
187 | { 60000.000000011525, 744.93626878652026, 920.45067498376648 }, |
188 | { 59999.999999986139, 851.85145355849977, 941.08553924856312 }, |
189 | { 60000.000000015752, 955.13474569084099, 960.32812261133847 }, |
190 | { 59999.99999996031, 1019.9477908992111, 972.25457694191095 }, |
191 | { 60000.000000078573, 1109.7424197388102, 989.27219905591903 }, |
192 | { 59999.999999866697, 1103.4472241364576, 986.24901738812696 }, |
193 | { 60000.000000196575, 1283.5502566789903, 1025.857653448167 }, |
194 | { 59999.999999756859, 1241.170752696316, 1010.5034788173898 }, |
195 | { 60000.000000241002, 1380.0598100152401, 1044.321387312001 }, |
196 | { 59999.999999814674, 1417.3346489504095, 1047.4285724180056 }, |
197 | { 60000.000000106025, 1498.5882349740116, 1064.7148393296281 }, |
198 | { 59999.999999959189, 1562.4075471540843, 1076.5692870450682 }, |
199 | { 60000.000000006847, 1632.0446827427525, 1089.9951747091934 }, |
200 | { 59999.999999992855, 1819.187180960379, 1125.8766969823027 }, |
201 | { 60000.000000006774, 2005.7867190244558, 1161.6893152514506 }, |
202 | { 59999.999999993102, 2127.1610378717864, 1184.8982806691761 }, |
203 | { 59999.999999983789, 2224.9504474907289, 1204.7794295042536 }, |
204 | { 60000.000000076092, 2423.4034586285211, 1239.2849934128672 }, |
205 | { 59999.999999843334, 2352.5108743508281, 1233.9178625300717 }, |
206 | { 60000.00000021555, 2789.1958451831979, 1304.7841887599538 }, |
207 | { 59999.999999781059, 2516.5832651666447, 1267.6317850640198 }, |
208 | { 60000.000000168911, 2997.8479508975411, 1347.2273537129538 }, |
209 | { 59999.999999901927, 2872.9560675152225, 1329.8998228537541 }, |
210 | { 60000.000000040534, 3100.1634765888271, 1371.640798220885 }, |
211 | { 59999.999999990199, 3186.6552406648925, 1389.3336814233451 }, |
212 | { 60000.000000019143, 3570.5318534479206, 1462.8626017289478 }, |
213 | { 59999.999999969914, 3906.3811637172125, 1522.697974792497 }, |
214 | { 60000.000000105116, 4081.0496155485694, 1554.1195061318422 }, |
215 | { 59999.999999764274, 4440.4680391955444, 1682.9362787226369 }, |
216 | { 60000.000000389882, 4025.4579062184348, 1482.6543564450828 }, |
217 | { 59999.999999500047, 5340.2058728577267, 2096.5041911809035 }, |
218 | { 60000.000000509819, 4233.9915572764976, 1518.9299243967394 }, |
219 | { 59999.999999583706, 5430.8345183928068, 2200.8401562891845 }, |
220 | { 60000.000000267981, 5054.5402162751188, 1969.4793692255021 }, |
221 | { 59999.999999871681, 5428.966058504895, 2244.2141001944756 }, |
222 | { 60000.000000038024, 5546.4649349764723, 2352.3606428637349 }, |
223 | { 59999.999999998952, 5706.4753141683368, 2517.0835536242184 }, |
224 | { 59999.999999991771, 6129.2268892602051, 3030.8327236291348 }, |
225 | { 60000.000000020089, 6420.3065439166912, 3661.6495160497966 }, |
226 | { 59999.99999990526, 6235.8646808219391, 3444.1541944672813 }, |
227 | { 60000.000000247288, 8126.8536394010316, 8890.661747328244 }, |
228 | { 59999.99999954299, 2104.925285609057, -7996.1134321147983 }, |
229 | { 60000.00000064441, 14264.475617875083, 34652.739991203249 }, |
230 | { 59999.999999283253, -1684.3290491164355, -33238.811620330394 }, |
231 | { 60000.000000641696, 13782.902589951687, 46532.286752882486 }, |
232 | { 59999.999999532913, 2699.6074087223524, -19079.410940396814 }, |
233 | { 60000.000000275439, 9084.6892111341349, 21937.827319607131 }, |
234 | { 59999.999999871587, 6474.8937324409353, 5006.3713661893671 }, |
235 | { 60000.000000044485, 7350.4434791870981, 10709.698171043074 }, |
236 | { 59999.999999990541, 7306.414330937022, 10560.108503883888 }, |
237 | { 60000, 7397.0783263606427, 11218.963217145942 } |
238 | }; |
239 | |
240 | const Standard_Integer Glob_NbKnots = 17; |
241 | const Standard_Real Glob_Knots[Glob_NbKnots] = |
242 | { |
243 | 0,0.0087664292723375857,0.015654339342331427,0.019098294377328347, |
244 | 0.020820271894826808,0.021681260653576038,0.022111755032950653,0.022327002222637962, |
245 | 0.022434625817481617,0.022488437614903441,0.022542249412325268,0.037523693790797889, |
246 | 0.071526893170125505,0.1421299556831544,0.26514857375331263,0.51350664396810353, |
247 | 1 }; |
248 | |
249 | const Standard_Integer Glob_Mults[Glob_NbKnots] = |
250 | { |
251 | 15,12,12,12,12,12,12,12, |
252 | 12,12,12,12,12,12,12,12, |
253 | 15 }; |
254 | |
255 | //======================================================================= |
256 | //function : OCC862 |
257 | //purpose : |
258 | //======================================================================= |
259 | static Standard_Integer OCC862 (Draw_Interpretor& di, Standard_Integer argc, const char** argv) |
260 | { |
261 | if ( argc != 3) { |
262 | di << "ERROR : Usage : " << argv[0] << " curve1 curve2" << "\n"; |
263 | return 1; |
264 | } |
265 | |
266 | Standard_Integer i; |
267 | // Fill array of poles |
268 | TColgp_Array1OfPnt aPoles(1,Glob_NbPoles); |
269 | for (i = 0; i < Glob_NbPoles; i++) |
270 | aPoles.SetValue(i+1,gp_Pnt(Glob_Poles[i][0],Glob_Poles[i][1],Glob_Poles[i][2])); |
271 | // Fill array of knots |
272 | TColStd_Array1OfReal aKnots(1,Glob_NbKnots); |
273 | for (i = 0; i < Glob_NbKnots; i++) |
274 | aKnots.SetValue(i+1,Glob_Knots[i]); |
275 | // Fill array of mults |
276 | TColStd_Array1OfInteger aMults(1,Glob_NbKnots); |
277 | for (i = 0; i < Glob_NbKnots; i++) |
278 | aMults.SetValue(i+1,Glob_Mults[i]); |
279 | // Create B-Spline curve |
f1e162f2 |
280 | const Standard_Integer aDegree = 14; |
7fd59977 |
281 | Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles,aKnots,aMults,aDegree); |
282 | |
283 | // Create trimmed line |
284 | gp_XYZ p1(60000,-7504.83,6000); |
285 | gp_XYZ p2(60000, 7504.83,6000); |
286 | Handle(Geom_Line) L = new Geom_Line(gp_Pnt(p1),gp_Dir(p2-p1)); |
287 | Handle(Geom_TrimmedCurve) C2 = new Geom_TrimmedCurve(L,0.0,(p2-p1).Modulus()); |
288 | |
289 | DrawTrSurf::Set(argv[1],C1); |
290 | DrawTrSurf::Set(argv[2],C2); |
291 | |
292 | // Try to find extrema |
293 | // IMPORTANT: it is not allowed to input infinite curves ! |
294 | GeomAPI_ExtremaCurveCurve Ex(C1,C2/*,C1f,C1l,C2f,C2l*/); |
295 | if (Ex.Extrema().IsParallel()) |
296 | { |
297 | di<<"Info: Infinite number of extrema, distance = "<<Ex.LowerDistance()<<"\n"; |
298 | } |
299 | else |
300 | { |
301 | // Check if extrema were found |
302 | const Standard_Integer nbEx = Ex.NbExtrema(); |
303 | if (nbEx) |
304 | { |
305 | // Get minimal distance data |
306 | gp_Pnt P1, P2; |
307 | Ex.NearestPoints(P1,P2); |
308 | Standard_Real U1, U2; |
309 | Ex.LowerDistanceParameters(U1,U2); |
310 | const Standard_Real D = Ex.LowerDistance(); |
311 | // IMPORTANT: minimal distance here means accuracy reached in intersection |
312 | di<<"Info: Minimal distance is "<<D<<"\n"; |
313 | di<<"Info: Minimal points are ("<<P1.X()<<","<<P1.Y()<<","<<P1.Z()<<"), ("<<P2.X()<<","<<P2.Y()<<","<<P2.Z()<<")"<<"\n"; |
314 | di<<"Info: Minimal parameters are ("<<U1<<"), ("<<U2<<")"<<"\n"; |
315 | } |
316 | else |
317 | { |
318 | di<<"Error: extrema not found"<<"\n"; |
319 | } |
320 | } |
321 | |
322 | return 0; |
323 | } |
324 | |
1cd84fee |
325 | void QABugs::Commands_7(Draw_Interpretor& theCommands) { |
326 | char *group = "QABugs"; |
7fd59977 |
327 | |
328 | theCommands.Add("OCC862", "OCC862 curve1 curve2", __FILE__, OCC862, group); |
329 | return; |
330 | } |