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