1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #include "QuadraticPlanarInterpTest.hxx"
22 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
23 #include "InterpKernelGeo2DElementaryEdge.hxx"
24 #include "InterpKernelGeo2DEdgeArcCircle.hxx"
25 #include "InterpKernelGeo2DEdgeLin.hxx"
32 using namespace INTERP_KERNEL;
40 DoubleEqual(double eps):_eps(eps) { }
41 bool operator()(double x, double y) { return fabs(x-y)<_eps; }
46 void QuadraticPlanarInterpTest::checkNonRegressionOmar0000()
48 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
49 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
51 -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
52 -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
55 -0.383022221559489, -0.1786061951567303, -0.5745333323392334, -0.01790929273509539, 0.5745333323392335, -0.01790929273509556, 0.383022221559489, -0.1786061951567304,
56 -0.4787777769493612, -0.0982577439459128, 4.592273826833915e-17, 0.25, 0.4787777769493612, -0.09825774394591297, 3.061515884555943e-17, 0 };
59 0, 1, 2, 3, 4, 5, 6, 7 };
60 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
61 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
62 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
65 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
66 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
67 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
72 void QuadraticPlanarInterpTest::checkNonRegressionOmar0001()
74 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
75 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
77 -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
78 -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
81 -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
82 -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
85 0, 1, 2, 3, 4, 5, 6, 7 };
86 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
87 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
88 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.272708,pol1->intersectWith(*pol2),1.e-6);
91 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
92 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
93 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.272708,pol2->intersectWith(*pol1),1.e-6);
98 void QuadraticPlanarInterpTest::checkNonRegressionOmar0002()
100 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
101 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
103 -0.383022221559489, 0.3213938048432697, -0.5745333323392334, 0.4820907072649046, 0.5745333323392335, 0.4820907072649044, 0.383022221559489, 0.3213938048432696,
104 -0.4787777769493612, 0.4017422560540872, 4.592273826833915e-17, 0.75, 0.4787777769493612, 0.401742256054087, 3.061515884555943e-17, 0.5 };
107 -0.4979288880273356, 0.4178119462962507, -0.6128355544951823, 0.5142300877492316, 0.6128355544951825, 0.5142300877492314, 0.4979288880273357, 0.4178119462962505,
108 -0.555382221261259, 0.4660210170227412, 4.898425415289509e-17, 0.8, 0.5553822212612591, 0.466021017022741, 3.979970649922726e-17, 0.65 };
111 0, 1, 2, 3, 4, 5, 6, 7 };
112 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
113 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
114 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.122173,pol1->intersectWith(*pol2),1.e-6);
117 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
118 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
119 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.122173,pol2->intersectWith(*pol1),1.e-6);
124 void QuadraticPlanarInterpTest::checkNonRegressionOmar0003()
126 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
127 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
129 -0.3535533905932737, 0.3535533905932738, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.3535533905932738, 0.3535533905932737,
130 -0.4419417382415922, 0.4419417382415922, 4.592273826833915e-17, 0.75, 0.4419417382415922, 0.4419417382415922, 3.061515884555943e-17, 0.5 };
133 -0.4979288880273356, 0.4178119462962507, -0.6128355544951823, 0.5142300877492316, 0.6128355544951825, 0.5142300877492314, 0.4979288880273357, 0.4178119462962505,
134 -0.555382221261259, 0.4660210170227412, 4.898425415289509e-17, 0.8, 0.5553822212612591, 0.466021017022741, 3.979970649922726e-17, 0.65 };
137 0, 1, 2, 3, 4, 5, 6, 7 };
138 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
139 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
140 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.109956,pol1->intersectWith(*pol2),1.e-6);
143 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
144 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
145 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.109956,pol2->intersectWith(*pol1),1.e-6);
150 void QuadraticPlanarInterpTest::checkNonRegressionOmar0004()
152 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
153 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
155 -0.4596194077712559, 0.4596194077712559, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.4596194077712559, 0.4596194077712559,
156 -0.4949747468305832, 0.4949747468305833, 4.592273826833915e-17, 0.75, 0.4949747468305833, 0.4949747468305832, 3.979970649922726e-17, 0.65 };
159 -0.383022221559489, 0.3213938048432697, -0.6128355544951823, 0.5142300877492316, 0.6128355544951825, 0.5142300877492314, 0.383022221559489, 0.3213938048432696,
160 -0.4979288880273356, 0.4178119462962507, 4.898425415289509e-17, 0.8, 0.4979288880273357, 0.4178119462962505, 3.061515884555943e-17, 0.5 };
163 0, 1, 2, 3, 4, 5, 6, 7 };
164 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
165 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
166 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.109956,pol1->intersectWith(*pol2),1.e-6);
169 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
170 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
171 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.109956,pol2->intersectWith(*pol1),1.e-6);
176 void QuadraticPlanarInterpTest::checkNonRegressionOmar0005()
178 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
179 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
181 -0.383022221559489, 0.3213938048432697, -0.6128355544951823, 0.5142300877492316, 0.6128355544951825, 0.5142300877492314, 0.383022221559489, 0.3213938048432696,
182 -0.4979288880273356, 0.4178119462962507, 4.898425415289509e-17, 0.8, 0.4979288880273357, 0.4178119462962505, 3.061515884555943e-17, 0.5 };
185 -0.4596194077712559, 0.4596194077712559, -0.5303300858899106, 0.5303300858899107, 0.5303300858899107, 0.5303300858899106, 0.4596194077712559, 0.4596194077712559,
186 -0.4949747468305832, 0.4949747468305833, 4.592273826833915e-17, 0.75, 0.4949747468305833, 0.4949747468305832, 3.979970649922726e-17, 0.65 };
189 0, 1, 2, 3, 4, 5, 6, 7 };
190 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
191 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
192 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.109956,pol1->intersectWith(*pol2),1.e-6);
195 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
196 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
197 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.109956,pol2->intersectWith(*pol1),1.e-6);
202 void QuadraticPlanarInterpTest::checkNonRegressionOmar0006()
204 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
205 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
207 -0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696,
208 -0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 };
211 -0.1811733315717646, 0.6761480784023478, -0.2070552360820167, 0.7727406610312547, 0.2070552360820166, 0.7727406610312547, 0.1811733315717645, 0.6761480784023478,
212 -0.1941142838268906, 0.7244443697168013, 4.898425415289509e-17, 0.8, 0.1941142838268906, 0.7244443697168013, 4.28612223837832e-17, 0.7 };
215 0, 1, 2, 3, 4, 5, 6, 7 };
216 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
217 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
218 std::vector<double> val1,val2;
219 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
220 double test1_res[4]={0.,0.366519,0.,0.};
221 double test2_res[4]={0.,0.,0.,0.366519};
222 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
223 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
228 void QuadraticPlanarInterpTest::checkNonRegressionOmar0007()
230 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
231 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
233 -0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696,
234 -0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 };
237 -0.4499513267805775, 0.5362311101832846, -0.5142300877492315, 0.6128355544951825, -0.1389185421335442, 0.7878462024097664, -0.1215537243668512, 0.6893654271085455,
238 -0.4820907072649045, 0.5745333323392335, -0.3380946093925595, 0.7250462296293201, -0.1302361332501977, 0.738605814759156, -0.2958327832184895, 0.634415450925655 };
241 0, 1, 2, 3, 4, 5, 6, 7 };
242 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
243 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
244 std::vector<double> val1,val2;
245 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
246 double test1_res[4]={0.,0.366519,0.,0.};
247 double test2_res[4]={0.,0.,0.,0.366519};
248 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
249 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
254 void QuadraticPlanarInterpTest::checkNonRegressionOmar0008()
256 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
257 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
259 -0.383022221559489, 0.3213938048432697, -0.5362311101832845, 0.4499513267805776, 0.5362311101832846, 0.4499513267805774, 0.383022221559489, 0.3213938048432696,
260 -0.4596266658713867, 0.3856725658119237, 4.28612223837832e-17, 0.7, 0.4596266658713868, 0.3856725658119236, 3.061515884555943e-17, 0.5 };
263 -0.6344154509256549, 0.2958327832184896, -0.72504622962932, 0.3380946093925596, -0.4588611490808367, 0.6553216354311937, -0.401503505445732, 0.5734064310022944,
264 -0.6797308402774874, 0.3169636963055246, -0.6128355544951823, 0.5142300877492316, -0.4301823272632844, 0.614364033216744, -0.5362311101832845, 0.4499513267805776 };
267 0, 1, 2, 3, 4, 5, 6, 7 };
268 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
269 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
270 std::vector<double> val1,val2;
271 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
272 double test1_res[4]={0.,0.18326,0.,0.};
273 double test2_res[4]={0.,0.,0.,0.18326};
274 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-5)));
275 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-5)));
280 void QuadraticPlanarInterpTest::checkNonRegressionOmar0009()
282 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
283 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
285 -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
286 -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 };
288 0.5, -1.224606353822377e-16, 0.6, -1.469527624586853e-16, -0.6, 7.347638122934263e-17, -0.5, 6.123031769111886e-17,
289 0.55, -1.347066989204615e-16, -1.102145718440139e-16, -0.6, -0.55, 6.735334946023075e-17, -9.184547653667829e-17, -0.5 };
292 0, 1, 2, 3, 4, 5, 6, 7 };
293 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
294 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
295 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
298 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
299 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
300 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
305 void QuadraticPlanarInterpTest::checkNonRegressionOmar0010()
307 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
308 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
310 -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
311 -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 };
313 0.4346666218300808, -0.1164685702961343, 0.579555495773441, -0.1552914270615124, -0.579555495773441, -0.1552914270615122, -0.4346666218300808, -0.1164685702961342,
314 0.5071110588017609, -0.1358799986788234, -1.102145718440139e-16, -0.6, -0.507111058801761, -0.1358799986788232, -8.266092888301047e-17, -0.45 };
317 0, 1, 2, 3, 4, 5, 6, 7 };
318 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
319 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
320 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
323 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
324 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
325 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
330 void QuadraticPlanarInterpTest::checkNonRegressionOmar0011()
332 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
333 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
335 -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
336 -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4 };
338 0.4829629131445342, -0.1294095225512603, 0.579555495773441, -0.1552914270615124, -0.579555495773441, -0.1552914270615122, -0.4829629131445342, -0.1294095225512602,
339 0.5312592044589877, -0.1423504748063864, -1.102145718440139e-16, -0.6, -0.5312592044589877, -0.1423504748063862, -9.184547653667829e-17, -0.5 };
342 0, 1, 2, 3, 4, 5, 6, 7 };
343 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
344 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
345 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
346 double val1,val2,val3;
347 pol1->intersectForPerimeter(*pol2,val1,val2,val3);
348 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val1,1.e-13);
349 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val2,1.e-13);
350 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val3,1.e-13);
351 std::vector<double> val4,val5;
352 pol1->intersectForPerimeterAdvanced(*pol2,val4,val5);
353 double test1_res[4]={0.,0.,0.,0.};
354 CPPUNIT_ASSERT(std::equal(val4.begin(),val4.end(),test1_res,DoubleEqual(1e-13)));
355 CPPUNIT_ASSERT(std::equal(val5.begin(),val5.end(),test1_res,DoubleEqual(1e-13)));
358 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
359 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
360 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
361 pol1->intersectForPerimeter(*pol2,val1,val2,val3);
362 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val1,1.e-13);
363 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val2,1.e-13);
364 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val3,1.e-13);
365 val4.clear(); val5.clear();
366 pol1->intersectForPerimeterAdvanced(*pol2,val4,val5);
367 CPPUNIT_ASSERT(std::equal(val4.begin(),val4.end(),test1_res,DoubleEqual(1e-13)));
368 CPPUNIT_ASSERT(std::equal(val5.begin(),val5.end(),test1_res,DoubleEqual(1e-13)));
373 void QuadraticPlanarInterpTest::checkNonRegressionOmar2511()
375 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
376 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
378 -0.3863703305156274, -0.1035276180410081, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512604, 0.3863703305156274, -0.1035276180410083,
379 -0.4346666218300808, -0.1164685702961342, 1.416374613080751e-16, 0.5, 0.4346666218300808, -0.1164685702961343, 1.133099690464601e-16, 0.4, };
382 0.579555495773441, -0.1552914270615124, -0.579555495773441, -0.1552914270615122, -0.4829629131445342, -0.1294095225512602, 0.4829629131445342, -0.1294095225512603,
383 -1.102145718440139e-16, -0.6, -0.5312592044589877, -0.1423504748063862, -9.184547653667829e-17, -0.5, 0.5312592044589877, -0.1423504748063864, };
386 0, 1, 2, 3, 4, 5, 6, 7 };
387 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
388 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
389 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
390 double val1,val2,val3;
391 pol1->intersectForPerimeter(*pol2,val1,val2,val3);
392 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val1,1.e-13);
393 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val2,1.e-13);
394 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val3,1.e-13);
395 std::vector<double> val4,val5;
396 pol1->intersectForPerimeterAdvanced(*pol2,val4,val5);
397 double test1_res[4]={0.,0.,0.,0.};
398 CPPUNIT_ASSERT(std::equal(val4.begin(),val4.end(),test1_res,DoubleEqual(1e-13)));
399 CPPUNIT_ASSERT(std::equal(val5.begin(),val5.end(),test1_res,DoubleEqual(1e-13)));
402 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
403 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
404 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
405 pol1->intersectForPerimeter(*pol2,val1,val2,val3);
406 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val1,1.e-13);
407 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val2,1.e-13);
408 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val3,1.e-13);
409 val4.clear(); val5.clear();
410 pol1->intersectForPerimeterAdvanced(*pol2,val4,val5);
411 CPPUNIT_ASSERT(std::equal(val4.begin(),val4.end(),test1_res,DoubleEqual(1e-13)));
412 CPPUNIT_ASSERT(std::equal(val5.begin(),val5.end(),test1_res,DoubleEqual(1e-13)));
417 void QuadraticPlanarInterpTest::checkNonRegressionOmar0012()
419 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
420 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
422 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
423 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
426 6.123031769111886e-18, 1.85, 1.224606353822377e-17, 1.95, 1.224606353822377e-17, 1.55, 6.123031769111886e-18, 1.65,
427 9.18454765366783e-18, 1.9, 0.2, 1.75, 9.18454765366783e-18, 1.6, 0.1, 1.75 };
430 0, 1, 2, 3, 4, 5, 6, 7 };
431 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
432 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
433 std::vector<double> val1,val2;
434 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
435 double test1_res[4]={0.,0.,0.05,0.};
436 double test2_res[4]={0.,0.,0.05,0.};
437 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
438 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
441 std::vector<int> val3;
442 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
443 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
444 pol1->intersectForPoint(*pol2,val3);
445 int test3_res[4]={0,0,1,0};
446 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
451 void QuadraticPlanarInterpTest::checkNonRegressionOmar0013()
453 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
454 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
456 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
457 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
460 6.123031769111886e-18, 1.7, 1.224606353822377e-17, 1.8, 1.224606353822377e-17, 1.4, 6.123031769111886e-18, 1.5,
461 9.18454765366783e-18, 1.75, 0.2, 1.6, 9.18454765366783e-18, 1.45, 0.1, 1.6 };
464 0, 1, 2, 3, 4, 5, 6, 7 };
465 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
466 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
467 std::vector<double> val1,val2;
468 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
469 double test1_res[4]={0.,0.,0.1,0.};
470 double test2_res[4]={0.,0.,0.1,0.};
471 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
472 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
475 std::vector<int> val3;
476 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
477 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
478 pol1->intersectForPoint(*pol2,val3);
479 int test3_res[4]={0,0,2,0};
480 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
485 void QuadraticPlanarInterpTest::checkNonRegressionOmar0014()
487 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
488 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
490 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
491 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
493 6.123031769111886e-18, 1.55, 1.224606353822377e-17, 1.65, 1.224606353822377e-17, 1.25, 6.123031769111886e-18, 1.35,
494 9.18454765366783e-18, 1.6, 0.2, 1.45, 9.18454765366783e-18, 1.3, 0.1, 1.45 };
497 0, 1, 2, 3, 4, 5, 6, 7 };
498 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
499 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
500 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
503 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
504 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
505 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
509 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
510 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
511 std::vector<double> val1,val2;
512 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
513 double test1_res[4]={0.,0.,0.15,0.};
514 double test2_res[4]={0.05,0.,0.1,0.};
515 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
516 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
519 std::vector<int> val3;
520 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
521 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
522 pol1->intersectForPoint(*pol2,val3);
523 int test3_res[4]={0,0,3,0};
524 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
529 void QuadraticPlanarInterpTest::checkNonRegressionOmar0015()
531 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
532 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
534 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
535 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
537 6.123031769111886e-18, 1.4, 1.224606353822377e-17, 1.5, 1.224606353822377e-17, 1.1, 6.123031769111886e-18, 1.2,
538 9.18454765366783e-18, 1.45, 0.2, 1.3, 9.18454765366783e-18, 1.15, 0.1, 1.3 };
541 0, 1, 2, 3, 4, 5, 6, 7 };
542 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
543 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
544 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
547 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
548 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
549 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
553 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
554 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
555 std::vector<double> val1,val2;
556 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
557 double test1_res[4]={0.,0.,0.2,0.};
558 double test2_res[4]={0.1,0.,0.1,0.};
559 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
560 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
563 std::vector<int> val3;
564 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
565 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
566 pol1->intersectForPoint(*pol2,val3);
567 int test3_res[4]={0,0,4,0};
568 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
573 void QuadraticPlanarInterpTest::checkNonRegressionOmar0016()
575 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
576 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
578 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
579 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
581 6.123031769111886e-18, 1.25, 1.224606353822377e-17, 1.35, 1.224606353822377e-17, 0.95, 6.123031769111886e-18, 1.05,
582 9.18454765366783e-18, 1.3, 0.2, 1.15, 9.18454765366783e-18, 0.9999999999999999, 0.1, 1.15 };
585 0, 1, 2, 3, 4, 5, 6, 7 };
586 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
587 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
588 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
591 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
592 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
593 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
597 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
598 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
599 std::vector<double> val1,val2;
600 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
601 double test1_res[4]={0.,0.,0.15,0.};
602 double test2_res[4]={0.1,0.,0.05,0.};
603 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
604 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
607 std::vector<int> val3;
608 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
609 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
610 pol1->intersectForPoint(*pol2,val3);
611 int test3_res[4]={0,0,3,0};
612 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
617 void QuadraticPlanarInterpTest::checkNonRegressionOmar0017()
619 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
620 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
622 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
623 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
626 6.123031769111886e-18, 1.1, 1.224606353822377e-17, 1.2, 1.224606353822377e-17, 0.8, 6.123031769111886e-18, 0.9,
627 9.18454765366783e-18, 1.15, 0.2, 1, 9.18454765366783e-18, 0.85, 0.1, 1 };
630 0, 1, 2, 3, 4, 5, 6, 7 };
631 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
632 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
633 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
636 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
637 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
638 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
642 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
643 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
644 std::vector<double> val1,val2;
645 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
646 double test1_res[4]={0.,0.,0.1,0.};
647 double test2_res[4]={0.1,0.,0.,0.};
648 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
649 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
652 std::vector<int> val3;
653 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
654 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
655 pol1->intersectForPoint(*pol2,val3);
656 int test3_res[4]={0,0,2,0};
657 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
662 void QuadraticPlanarInterpTest::checkNonRegressionOmar0018()
664 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
665 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
667 -1, 1.224606353822377e-16, -1.6, 1.959370166115804e-16, 9.796850830579018e-17, 1.6, 6.123031769111886e-17, 1,
668 -1.3, 1.591988259969091e-16, -1.131370849898476, 1.131370849898476, 7.959941299845453e-17, 1.3, -0.7071067811865475, 0.7071067811865476 };
671 6.123031769111886e-18, 0.95, 1.224606353822377e-17, 1.05, 1.224606353822377e-17, 0.6499999999999999, 6.123031769111886e-18, 0.75,
672 9.18454765366783e-18, 1, 0.2, 0.85, 9.18454765366783e-18, 0.7, 0.1, 0.85 };
675 0, 1, 2, 3, 4, 5, 6, 7 };
676 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
677 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
678 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
681 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
682 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
683 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
687 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
688 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
689 std::vector<double> val1,val2;
690 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
691 double test1_res[4]={0.,0.,0.05,0.};
692 double test2_res[4]={0.05,0.,0.,0.};
693 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
694 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
697 std::vector<int> val3;
698 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
699 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
700 pol1->intersectForPoint(*pol2,val3);
701 int test3_res[4]={0,0,1,0};
702 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
707 void QuadraticPlanarInterpTest::checkNonRegressionOmar0019()
709 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
710 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
712 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
713 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
716 0.9500000000000001, 1.836909530733566e-17, 0.8, 3.673819061467131e-17, 1.4, 0, 1.25, 0,
717 0.8750000000000001, 2.755364296100349e-17, 1.1, 0.3, 1.325, 0, 1.1, 0.15 };
720 0, 1, 2, 3, 4, 5, 6, 7 };
721 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
722 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
723 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
726 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
727 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
728 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
733 void QuadraticPlanarInterpTest::checkNonRegressionOmar0020()
735 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
736 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
738 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
739 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
742 0.05000000000000002, 1.836909530733566e-17, -0.09999999999999998, 3.673819061467131e-17, 0.5, 0, 0.35, 0,
743 -0.02499999999999997, 2.755364296100349e-17, 0.2, 0.3, 0.425, 0, 0.2, 0.15 };
746 0, 1, 2, 3, 4, 5, 6, 7 };
747 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
748 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
749 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
752 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
753 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
754 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
758 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
759 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
760 std::vector<double> val1,val2;
761 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
762 double test1_res[4]={0.,0.,0.,0.};
763 double test2_res[4]={0.,0.,0.,0.};
764 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
765 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
768 std::vector<int> val3;
769 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
770 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
771 pol1->intersectForPoint(*pol2,val3);
772 int test3_res[4]={0,0,0,0};
773 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
778 void QuadraticPlanarInterpTest::checkNonRegressionOmar0021()
780 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
781 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
783 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
784 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
787 -1, -0.07999999999999999, -1.15, -0.07999999999999996, -0.55, -0.08, -0.7, -0.08,
788 -1.075, -0.07999999999999997, -0.85, 0.22, -0.625, -0.08, -0.85, 0.06999999999999999 };
791 0, 1, 2, 3, 4, 5, 6, 7 };
792 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
793 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
794 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0311485,pol1->intersectWith(*pol2),1.e-7);
797 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
798 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
799 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0311485,pol2->intersectWith(*pol1),1.e-7);
803 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
804 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
805 std::vector<double> val1,val2;
806 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
807 double test1_res[4]={0.162251,0.151523,0.,0.};
808 double test2_res[4]={0.,0.311383,0.,0.0978193};
809 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
810 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
813 std::vector<int> val3;
814 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
815 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
816 pol1->intersectForPoint(*pol2,val3);
817 int test3_res[4]={2,2,0,0};
818 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
822 void QuadraticPlanarInterpTest::checkNonRegressionOmar0022()
824 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
825 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
827 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
828 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
831 0.15, -0.07999999999999999, 0, -0.07999999999999996, 0.6, -0.08, 0.45, -0.08,
832 0.07500000000000001, -0.07999999999999997, 0.3, 0.22, 0.5249999999999999, -0.08, 0.3, 0.06999999999999999 };
835 0, 1, 2, 3, 4, 5, 6, 7 };
836 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
837 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
838 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00902229,pol1->intersectWith(*pol2),1.e-8);
841 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
842 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
843 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00902229,pol2->intersectWith(*pol1),1.e-8);
848 void QuadraticPlanarInterpTest::checkNonRegressionOmar0023()
850 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
851 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
853 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
854 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5, };
857 0.4156854249492381, 0.5656854249492381, 0.2656854249492381, 0.5656854249492381, 0.8656854249492381, 0.5656854249492381, 0.7156854249492381, 0.5656854249492381,
858 0.3406854249492381, 0.5656854249492381, 0.5656854249492381, 0.8656854249492381, 0.7906854249492381, 0.5656854249492381, 0.5656854249492381, 0.7156854249492381 };
861 0, 1, 2, 3, 4, 5, 6, 7 };
862 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
863 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
864 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0215659,pol1->intersectWith(*pol2),1.e-7);
867 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
868 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
869 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0215659,pol2->intersectWith(*pol1),1.e-7);
874 void QuadraticPlanarInterpTest::checkNonRegressionOmar0024()
876 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
877 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
879 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
880 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
882 0.5656854249492381, 0.5656854249492381, 0.4156854249492382, 0.5656854249492381, 1.015685424949238, 0.5656854249492381, 0.8656854249492382, 0.5656854249492381,
883 0.4906854249492382, 0.5656854249492381, 0.7156854249492381, 0.8656854249492381, 0.9406854249492381, 0.5656854249492381, 0.7156854249492381, 0.7156854249492381 };
886 0, 1, 2, 3, 4, 5, 6, 7 };
887 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
888 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
889 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00877657,pol1->intersectWith(*pol2),1.e-8);
892 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
893 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
894 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00877657,pol2->intersectWith(*pol1),1.e-8);
899 void QuadraticPlanarInterpTest::checkNonRegressionOmar2524()
901 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
902 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
904 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
905 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
907 0.4156854249492382, 0.5656854249492381, 1.015685424949238, 0.5656854249492381, 0.8656854249492382, 0.5656854249492381, 0.5656854249492381, 0.5656854249492381,
908 0.7156854249492381, 0.8656854249492381, 0.9406854249492381, 0.5656854249492381, 0.7156854249492381, 0.7156854249492381, 0.4906854249492382, 0.5656854249492381 };
911 0, 1, 2, 3, 4, 5, 6, 7 };
912 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
913 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
914 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00877657,pol1->intersectWith(*pol2),1.e-8);
917 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
918 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
919 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00877657,pol2->intersectWith(*pol1),1.e-8);
924 void QuadraticPlanarInterpTest::checkNonRegressionOmar0025()
926 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
927 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
929 -0.5, 6.123031769111886e-17, -0.8, 9.796850830579018e-17, 0.8, 0, 0.5, 0,
930 -0.65, 7.959941299845453e-17, 4.898425415289509e-17, 0.8, 0.65, 0, 3.061515884555943e-17, 0.5 };
933 0.715685424949238, 0.5656854249492381, 0.565685424949238, 0.5656854249492381, 1.165685424949238, 0.5656854249492381, 1.015685424949238, 0.5656854249492381,
934 0.6406854249492381, 0.5656854249492381, 0.8656854249492381, 0.8656854249492381, 1.090685424949238, 0.5656854249492381, 0.8656854249492381, 0.7156854249492381 };
937 0, 1, 2, 3, 4, 5, 6, 7 };
938 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
939 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
940 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
943 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
944 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
945 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
949 std::vector<int> val3;
950 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
951 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
952 pol1->intersectForPoint(*pol2,val3);
953 int test3_res[4]={0,1,0,0};
954 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
959 void QuadraticPlanarInterpTest::checkNonRegressionOmar0026()
961 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
962 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
964 -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
965 -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
968 0.1, 0.95, 0.2, 0.95, -0.2, 0.95, -0.1, 0.95,
969 0.15, 0.95, 1.224606353822377e-17, 0.75, -0.15, 0.95, 6.123031769111886e-18, 0.85 };
972 0, 1, 2, 3, 4, 5, 6, 7 };
973 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
974 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
975 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
978 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
979 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
980 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
984 std::vector<int> val3;
985 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
986 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
987 pol1->intersectForPoint(*pol2,val3);
988 int test3_res[4]={0,1,0,0};
989 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
994 void QuadraticPlanarInterpTest::checkNonRegressionOmar0027()
996 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
997 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
999 -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
1000 -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
1002 double coords2[16]={
1003 -0.1, 0.7, -0.2, 0.7, 0.2, 0.7, 0.1, 0.7,
1004 -0.15, 0.7, 1.224606353822377e-17, 0.8999999999999999, 0.15, 0.7, 6.123031769111886e-18, 0.7999999999999999 };
1007 0, 1, 2, 3, 4, 5, 6, 7 };
1008 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1009 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1010 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00712309,pol1->intersectWith(*pol2),1.e-8);
1013 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1014 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1015 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00712309,pol2->intersectWith(*pol1),1.e-8);
1019 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1020 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1021 std::vector<double> val1,val2;
1022 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
1023 double test1_res[4]={0.,0.222704,0.,0.};
1024 double test2_res[4]={0.1,0.0465335,0.1,0.092554};
1025 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
1026 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
1029 std::vector<int> val3;
1030 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1031 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1032 pol1->intersectForPoint(*pol2,val3);
1033 int test3_res[4]={0,4,0,0};
1034 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
1039 void QuadraticPlanarInterpTest::checkNonRegressionOmar0028()
1041 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
1042 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
1044 -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
1045 -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
1047 double coords2[16]={
1048 -0.07071067811865477, 0.4792893218813453, -0.1414213562373095, 0.4085786437626905, 0.1414213562373095, 0.6914213562373095, 0.07071067811865477, 0.6207106781186548,
1049 -0.1060660171779822, 0.4439339828220179, -0.1414213562373095, 0.6914213562373096, 0.1060660171779822, 0.6560660171779822, -0.07071067811865475, 0.6207106781186548 };
1052 0, 1, 2, 3, 4, 5, 6, 7 };
1053 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1054 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1055 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0471239,pol1->intersectWith(*pol2),1.e-7);
1058 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1059 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1060 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0471239,pol2->intersectWith(*pol1),1.e-7);
1064 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1065 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1066 std::vector<double> val1,val2;
1067 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
1068 double test1_res[4]={0.,0.,0.,0.};
1069 double test2_res[4]={0.1,0.628319,0.1,0.314159};
1070 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
1071 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
1074 std::vector<int> val3;
1075 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1076 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1077 pol1->intersectForPoint(*pol2,val3);
1078 int test3_res[4]={0,1,0,0};
1079 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
1084 void QuadraticPlanarInterpTest::checkNonRegressionOmar0029()
1086 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
1087 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
1089 -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
1090 -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
1092 double coords2[16]={
1093 -0.07071067811865477, 0.1292893218813453, -0.1414213562373095, 0.05857864376269051, 0.1414213562373095, 0.3414213562373095, 0.07071067811865477, 0.2707106781186548,
1094 -0.1060660171779822, 0.09393398282201787, -0.1414213562373095, 0.3414213562373095, 0.1060660171779822, 0.3060660171779822, -0.07071067811865475, 0.2707106781186548 };
1097 0, 1, 2, 3, 4, 5, 6, 7 };
1098 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1099 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1100 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol1->intersectWith(*pol2),1.e-13);
1103 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1104 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1105 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
1109 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1110 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1111 std::vector<double> val1,val2;
1112 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
1113 double test1_res[4]={0.,0.,0.,0.};
1114 double test2_res[4]={0.,0.,0.,0.};
1115 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-13)));
1116 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
1119 std::vector<int> val3;
1120 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1121 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1122 pol1->intersectForPoint(*pol2,val3);
1123 int test3_res[4]={0,0,0,1};
1124 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
1129 void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
1131 INTERP_KERNEL::QuadraticPlanarPrecision::setPrecision(1e-7);
1132 INTERP_KERNEL::QuadraticPlanarArcDetectionPrecision::setArcDetectionPrecision(1e-7);
1134 -0.4, 4.898425415289509e-17, -0.75, 9.184547653667829e-17, 0.75, 0, 0.4, 0,
1135 -0.575, 7.041486534478669e-17, 4.592273826833915e-17, 0.75, 0.575, 0, 2.449212707644755e-17, 0.4 };
1137 double coords2[16]={
1138 -0.4889087296526012, 0.3889087296526012, -0.5889087296526012, 0.3889087296526012, -0.1889087296526012, 0.3889087296526012, -0.2889087296526012, 0.3889087296526012,
1139 -0.5389087296526012, 0.3889087296526012, -0.3889087296526012, 0.5889087296526012, -0.2389087296526012, 0.3889087296526012, -0.3889087296526012, 0.4889087296526012 };
1142 0, 1, 2, 3, 4, 5, 6, 7 };
1143 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1144 QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1145 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0471239,pol1->intersectWith(*pol2),1.e-7);
1148 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1149 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1150 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0471239,pol2->intersectWith(*pol1),1.e-7);
1154 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1155 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1156 std::vector<double> val1,val2;
1157 pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
1158 double test1_res[4]={0.,0.,0.,0.};
1159 double test2_res[4]={0.1,0.628319,0.1,0.314159};
1160 CPPUNIT_ASSERT(std::equal(val1.begin(),val1.end(),test1_res,DoubleEqual(1e-6)));
1161 CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
1164 std::vector<int> val3;
1165 pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1166 pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1167 pol1->intersectForPoint(*pol2,val3);
1168 int test3_res[4]={0,1,0,0};
1169 CPPUNIT_ASSERT(std::equal(val3.begin(),val3.end(),test3_res));
1174 void QuadraticPlanarInterpTest::checkIsInOrOut()
1176 double coords[8]={ 0.30662641093707971, -0.47819928619088981,
1177 -0.47819928619088964, 0.30662641093707987,
1181 coords[4] = (coords[0] + coords[2]) / 2.0;
1182 coords[5] = (coords[1] + coords[3]) / 2.0;
1184 int tab4[4]={ 0, 1, 2, 3};
1185 QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab4,4);
1186 Node * n = new Node(0.3175267678416348, -0.4890996430954449);
1188 CPPUNIT_ASSERT(! pol1->isInOrOut(n)); // node should be out
1193 void QuadraticPlanarInterpTest::checkGetMiddleOfPoints()
1195 { // from testIntersect2DMeshWith1DLine6()
1196 double p1[] = {0.51641754716735844, 2.0};
1197 double p2[] = {0.0, 1.0};
1198 double e_center[] = {-0.71, 2.0};
1199 double mid[] = {0.0,0.0}; // out
1200 double mide[] = {0.0,0.0}; // expected
1202 Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
1203 // start, end, center_x, center_y, radius, angle0, angle
1204 EdgeArcCircle e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388);
1206 e.getMiddleOfPoints(p1, p2, mid);
1207 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
1208 CPPUNIT_ASSERT_DOUBLES_EQUAL(1.4372640310451197, mid[1], 1.e-7);
1210 e.getMiddleOfPoints(p2, p1, mid);
1211 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
1212 CPPUNIT_ASSERT_DOUBLES_EQUAL(1.4372640310451197, mid[1], 1.e-7);
1214 start->decrRef(); end->decrRef();
1216 { // from testSwig2Intersect2DMeshWith1DLine11()
1217 double p1[] = {-1., 0.23453685964236054};
1218 double p2[] = {-0.23453685964235979, 1.0};
1219 double e_center[] = {-4.85, 4.85};
1220 double mid[] = {0.0,0.0}; // out
1222 Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
1223 // start, end, center_x, center_y, radius, angle0, angle
1224 EdgeArcCircle e(start, end, e_center, 6.0104076400856474, -0.69522150912422953, -0.18035330854643861);
1226 e.getMiddleOfPoints(p1, p2, mid);
1227 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.6, mid[0], 1.e-7);
1228 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6, mid[1], 1.e-7);
1230 e.getMiddleOfPoints(p2, p1, mid);
1231 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.6, mid[0], 1.e-7);
1232 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6, mid[1], 1.e-7);
1234 start->decrRef(); end->decrRef();
1236 { // from testSwig2Intersect2DMeshWith1DLine11()
1237 double p1[] = {-0.1303327636866019, -1.0};
1238 double p2[] = {-1.0, -0.1303327636866019};
1239 double e_center[] = {-1.9833333333333298, -1.9833333333333298};
1240 double mid[] = {0.0,0.0}; // out
1242 Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
1243 // start, end, center_x, center_y, radius, angle0, angle
1244 EdgeArcCircle e(start, end, e_center, 2.0977501175200861, 1.0829141821052615, -0.59503203741562627);
1246 e.getMiddleOfPoints(p1, p2, mid);
1247 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[0], 1.e-7);
1248 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[1], 1.e-7);
1250 e.getMiddleOfPoints(p2, p1, mid);
1251 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[0], 1.e-7);
1252 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[1], 1.e-7);
1254 start->decrRef(); end->decrRef();
1258 void QuadraticPlanarInterpTest::checkGetMiddleOfPointsOriented()
1260 { // from testSwig2Colinearize2D3()
1261 double p1[] = {-0.70710678118654746, 0.70710678118654757};
1262 double p2[] = {-0.70710678118654768, -0.70710678118654746};
1263 double e_center[] = {0., 0.};
1264 double mid[] = {0.0,0.0}; // out
1266 Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
1267 // start, end, center_x, center_y, radius, angle0, angle
1268 EdgeArcCircle e(start, end, e_center, 1.0, -0.7853981633974485, -1.5707963267948966);
1270 e.getMiddleOfPointsOriented(p1, p2, mid);
1271 CPPUNIT_ASSERT_DOUBLES_EQUAL(1., mid[0], 1.e-7);
1272 CPPUNIT_ASSERT_DOUBLES_EQUAL(0., mid[1], 1.e-7);
1274 e.getMiddleOfPoints(p1, p2, mid);
1275 CPPUNIT_ASSERT_DOUBLES_EQUAL(-1., mid[0], 1.e-7);
1276 CPPUNIT_ASSERT_DOUBLES_EQUAL(0., mid[1], 1.e-7);
1278 e.getMiddleOfPointsOriented(p2, p1, mid);
1279 CPPUNIT_ASSERT_DOUBLES_EQUAL(-1., mid[0], 1.e-7);
1280 CPPUNIT_ASSERT_DOUBLES_EQUAL(0., mid[1], 1.e-7);
1282 start->decrRef(); end->decrRef();