]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx
Salome HOME
494e9530a7db9f95d2a29bc1f4fd3fb2e877389a
[tools/medcoupling.git] / src / INTERP_KERNELTest / QuadraticPlanarInterpTest5.cxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #include "QuadraticPlanarInterpTest.hxx"
22 #include "InterpKernelGeo2DQuadraticPolygon.hxx"
23 #include "InterpKernelGeo2DElementaryEdge.hxx"
24 #include "InterpKernelGeo2DEdgeArcCircle.hxx"
25 #include "InterpKernelGeo2DEdgeLin.hxx"
26
27 #include <cmath>
28 #include <sstream>
29 #include <iostream>
30 #include <iterator>
31
32 using namespace INTERP_KERNEL;
33
34 namespace INTERP_TEST
35 {
36
37 class DoubleEqual
38 {
39 public:
40   DoubleEqual(double eps):_eps(eps) { }
41   bool operator()(double x, double y) { return fabs(x-y)<_eps; }
42 private:
43   double _eps;
44 };
45
46 void QuadraticPlanarInterpTest::checkNonRegressionOmar0000()
47 {
48   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
49   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
50   double coords[16]={
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 };
53   
54   double coords2[16]={
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 };
57
58   int tab8[8]={
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);
63   delete pol1;
64   delete pol2;
65   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
66   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
67   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
68   delete pol1;
69   delete pol2;
70 }
71
72 void QuadraticPlanarInterpTest::checkNonRegressionOmar0001()
73 {
74   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
75   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
76   double coords[16]={
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 };
79   
80   double coords2[16]={
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 };
83   
84   int tab8[8]={
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);
89   delete pol1;
90   delete pol2;
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);
94   delete pol1;
95   delete pol2;
96 }
97
98 void QuadraticPlanarInterpTest::checkNonRegressionOmar0002()
99 {
100   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
101   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
102   double coords[16]={
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 };
105   
106   double coords2[16]={
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 };
109
110   int tab8[8]={
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);
115   delete pol1;
116   delete pol2;
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);
120   delete pol1;
121   delete pol2;
122 }
123
124 void QuadraticPlanarInterpTest::checkNonRegressionOmar0003()
125 {
126   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
127   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
128   double coords[16]={
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 };
131   
132   double coords2[16]={
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 };
135
136   int tab8[8]={
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);
141   delete pol1;
142   delete pol2;
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);
146   delete pol1;
147   delete pol2;
148 }
149
150 void QuadraticPlanarInterpTest::checkNonRegressionOmar0004()
151 {
152   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
153   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
154   double coords[16]={
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 };
157
158   double coords2[16]={
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 };
161
162   int tab8[8]={
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);
167   delete pol1;
168   delete pol2;
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);
172   delete pol1;
173   delete pol2;
174 }
175
176 void QuadraticPlanarInterpTest::checkNonRegressionOmar0005()
177 {
178   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
179   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
180   double coords[16]={
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 };
183   
184   double coords2[16]={
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 };
187   
188   int tab8[8]={
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);
193   delete pol1;
194   delete pol2;
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);
198   delete pol1;
199   delete pol2;
200 }
201
202 void QuadraticPlanarInterpTest::checkNonRegressionOmar0006()
203 {
204   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
205   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
206   double coords[16]={
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 };
209   
210   double coords2[16]={
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 };
213   
214   int tab8[8]={
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)));
224   delete pol1;
225   delete pol2;
226 }
227
228 void QuadraticPlanarInterpTest::checkNonRegressionOmar0007()
229 {
230   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
231   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
232   double coords[16]={
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 };
235   
236   double coords2[16]={
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 };
239   
240   int tab8[8]={
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)));
250   delete pol1;
251   delete pol2;
252 }
253
254 void QuadraticPlanarInterpTest::checkNonRegressionOmar0008()
255 {
256   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
257   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
258   double coords[16]={
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 };
261   
262   double coords2[16]={
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 };
265   
266   int tab8[8]={
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)));
276   delete pol1;
277   delete pol2;
278 }
279
280 void QuadraticPlanarInterpTest::checkNonRegressionOmar0009()
281 {
282   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
283   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
284   double coords[16]={
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 };
287   double coords2[16]={
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 };
290   
291   int tab8[8]={
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);
296   delete pol1;
297   delete pol2;
298   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
299   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
300   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
301   delete pol1;
302   delete pol2;
303 }
304
305 void QuadraticPlanarInterpTest::checkNonRegressionOmar0010()
306 {
307   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
308   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
309   double coords[16]={
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 };
312   double coords2[16]={
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 };
315   
316   int tab8[8]={
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);
321   delete pol1;
322   delete pol2;
323   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
324   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
325   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
326   delete pol1;
327   delete pol2;
328 }
329
330 void QuadraticPlanarInterpTest::checkNonRegressionOmar0011()
331 {
332   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
333   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
334   double coords[16]={
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 };
337   double coords2[16]={
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 };
340   
341   int tab8[8]={
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)));
356   delete pol1;
357   delete pol2;
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)));
369   delete pol1;
370   delete pol2;
371 }
372
373 void QuadraticPlanarInterpTest::checkNonRegressionOmar2511()
374 {
375   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
376   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
377   double coords[16]={
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, };
380   
381   double coords2[16]={
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, };
384
385   int tab8[8]={
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)));
400   delete pol1;
401   delete pol2;
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)));
413   delete pol1;
414   delete pol2;
415 }
416
417 void QuadraticPlanarInterpTest::checkNonRegressionOmar0012()
418 {
419   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
420   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
421   double coords[16]={
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 };
424   
425   double coords2[16]={
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 };
428   
429   int tab8[8]={
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)));
439   delete pol1;
440   delete pol2;
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));
447   delete pol1;
448   delete pol2;
449 }
450
451 void QuadraticPlanarInterpTest::checkNonRegressionOmar0013()
452 {
453   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
454   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
455   double coords[16]={
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 };
458   
459   double coords2[16]={
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 };
462
463   int tab8[8]={
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)));
473   delete pol1;
474   delete pol2;
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));
481   delete pol1;
482   delete pol2;
483 }
484
485 void QuadraticPlanarInterpTest::checkNonRegressionOmar0014()
486 {
487   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
488   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
489   double coords[16]={
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 };
492   double coords2[16]={
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 };
495   
496   int tab8[8]={
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);
501   delete pol1;
502   delete pol2;
503   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
504   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
505   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
506   delete pol1;
507   delete pol2;
508   //
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)));
517   delete pol1;
518   delete pol2;
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));
525   delete pol1;
526   delete pol2;
527 }
528
529 void QuadraticPlanarInterpTest::checkNonRegressionOmar0015()
530 {
531   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
532   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
533   double coords[16]={
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 };
536   double coords2[16]={
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 };
539   
540   int tab8[8]={
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);
545   delete pol1;
546   delete pol2;
547   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
548   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
549   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
550   delete pol1;
551   delete pol2;
552   //
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)));
561   delete pol1;
562   delete pol2;
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));
569   delete pol1;
570   delete pol2;
571 }
572
573 void QuadraticPlanarInterpTest::checkNonRegressionOmar0016()
574 {
575   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
576   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
577   double coords[16]={
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 };
580   double coords2[16]={
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 };
583   
584   int tab8[8]={
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);
589   delete pol1;
590   delete pol2;
591   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
592   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
593   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
594   delete pol1;
595   delete pol2;
596   //
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)));
605   delete pol1;
606   delete pol2;
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));
613   delete pol1;
614   delete pol2;
615 }
616
617 void QuadraticPlanarInterpTest::checkNonRegressionOmar0017()
618 {
619   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
620   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
621   double coords[16]={
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 };
624   
625   double coords2[16]={
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 };
628
629   int tab8[8]={
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);
634   delete pol1;
635   delete pol2;
636   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
637   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
638   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
639   delete pol1;
640   delete pol2;
641   //
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)));
650   delete pol1;
651   delete pol2;
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));
658   delete pol1;
659   delete pol2;
660 }
661
662 void QuadraticPlanarInterpTest::checkNonRegressionOmar0018()
663 {
664   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
665   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
666   double coords[16]={
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 };
669   
670   double coords2[16]={
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 };
673
674   int tab8[8]={
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);
679   delete pol1;
680   delete pol2;
681   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
682   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
683   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
684   delete pol1;
685   delete pol2;
686   //
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)));
695   delete pol1;
696   delete pol2;
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));
703   delete pol1;
704   delete pol2;
705 }
706
707 void QuadraticPlanarInterpTest::checkNonRegressionOmar0019()
708 {
709   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
710   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
711   double coords[16]={
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 };
714   
715   double coords2[16]={
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 };
718
719   int tab8[8]={
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);
724   delete pol1;
725   delete pol2;
726   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
727   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
728   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
729   delete pol1;
730   delete pol2;
731 }
732
733 void QuadraticPlanarInterpTest::checkNonRegressionOmar0020()
734 {
735   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
736   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
737   double coords[16]={
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 };
740   
741   double coords2[16]={
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 };
744   
745   int tab8[8]={
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);
750   delete pol1;
751   delete pol2;
752   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
753   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
754   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
755   delete pol1;
756   delete pol2;
757   //
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)));
766   delete pol1;
767   delete pol2;
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));
774   delete pol1;
775   delete pol2;
776 }
777
778 void QuadraticPlanarInterpTest::checkNonRegressionOmar0021()
779 {
780   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
781   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
782   double coords[16]={
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 };
785   
786   double coords2[16]={
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 };
789   
790   int tab8[8]={
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);
795   delete pol1;
796   delete pol2;
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);
800   delete pol1;
801   delete pol2;
802   //
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)));
811   delete pol1;
812   delete pol2;
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));
819   delete pol1;
820   delete pol2;
821 }
822 void QuadraticPlanarInterpTest::checkNonRegressionOmar0022()
823 {
824   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
825   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
826   double coords[16]={
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 };
829   
830   double coords2[16]={
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 };
833   
834   int tab8[8]={
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);
839   delete pol1;
840   delete pol2;
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);
844   delete pol1;
845   delete pol2;
846 }
847
848 void QuadraticPlanarInterpTest::checkNonRegressionOmar0023()
849 {
850   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
851   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
852   double coords[16]={
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, };
855   
856   double coords2[16]={
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 };
859   
860   int tab8[8]={
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);
865   delete pol1;
866   delete pol2;
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);
870   delete pol1;
871   delete pol2;
872 }
873
874 void QuadraticPlanarInterpTest::checkNonRegressionOmar0024()
875 {
876   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
877   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
878   double coords[16]={
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 };
881   double coords2[16]={
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 };
884   
885   int tab8[8]={
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);
890   delete pol1;
891   delete pol2;
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);
895   delete pol1;
896   delete pol2;
897 }
898
899 void QuadraticPlanarInterpTest::checkNonRegressionOmar2524()
900 {
901   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
902   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
903   double coords[16]={
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 };
906   double coords2[16]={
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 };
909   
910   int tab8[8]={
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);
915   delete pol1;
916   delete pol2;
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);
920   delete pol1;
921   delete pol2;
922 }
923
924 void QuadraticPlanarInterpTest::checkNonRegressionOmar0025()
925 {
926   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
927   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
928   double coords[16]={
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 };
931   
932   double coords2[16]={
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 };
935
936   int tab8[8]={
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);
941   delete pol1;
942   delete pol2;
943   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
944   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
945   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
946   delete pol1;
947   delete pol2;
948   //
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));
955   delete pol1;
956   delete pol2;
957 }
958
959 void QuadraticPlanarInterpTest::checkNonRegressionOmar0026()
960 {
961   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
962   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
963   double coords[16]={
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 };
966   
967   double coords2[16]={
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 };
970   
971   int tab8[8]={
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);
976   delete pol1;
977   delete pol2;
978   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
979   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
980   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
981   delete pol1;
982   delete pol2;
983   //
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));
990   delete pol1;
991   delete pol2;
992 }
993
994 void QuadraticPlanarInterpTest::checkNonRegressionOmar0027()
995 {
996   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
997   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
998   double coords[16]={
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 };
1001   
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 };
1005   
1006   int tab8[8]={
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);
1011   delete pol1;
1012   delete pol2;
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);
1016   delete pol1;
1017   delete pol2;
1018   //
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)));
1027   delete pol1;
1028   delete pol2;
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));
1035   delete pol1;
1036   delete pol2;
1037 }
1038
1039 void QuadraticPlanarInterpTest::checkNonRegressionOmar0028()
1040 {
1041   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
1042   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
1043   double coords[16]={
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 };
1046   
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 };
1050   
1051   int tab8[8]={
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);
1056   delete pol1;
1057   delete pol2;
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);
1061   delete pol1;
1062   delete pol2;
1063   //
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)));
1072   delete pol1;
1073   delete pol2;
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));
1080   delete pol1;
1081   delete pol2;
1082 }
1083
1084 void QuadraticPlanarInterpTest::checkNonRegressionOmar0029()
1085 {
1086   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
1087   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
1088   double coords[16]={
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 };
1091   
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 };
1095   
1096   int tab8[8]={
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);
1101   delete pol1;
1102   delete pol2;
1103   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
1104   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
1105   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,pol2->intersectWith(*pol1),1.e-13);
1106   delete pol1;
1107   delete pol2;
1108   //
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)));
1117   delete pol1;
1118   delete pol2;
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));
1125   delete pol1;
1126   delete pol2;
1127 }
1128
1129 void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
1130 {
1131   INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
1132   INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
1133   double coords[16]={
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 };
1136   
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 };
1140   
1141   int tab8[8]={
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);
1146   delete pol1;
1147   delete pol2;
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);
1151   delete pol1;
1152   delete pol2;
1153   //
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)));
1162   delete pol1;
1163   delete pol2;
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));
1170   delete pol1;
1171   delete pol2;
1172 }
1173
1174 void QuadraticPlanarInterpTest::checkIsInOrOut()
1175 {
1176   double coords[8]={   0.30662641093707971,  -0.47819928619088981,
1177                       -0.47819928619088964,  0.30662641093707987,
1178                        0.0, 0.0,
1179                        0.4, 0.4
1180   };
1181   coords[4] = (coords[0] + coords[2]) / 2.0;
1182   coords[5] = (coords[1] + coords[3]) / 2.0;
1183
1184   int tab4[4]={ 0, 1, 2, 3};
1185   QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab4,4);
1186   Node * n = new Node(0.3175267678416348, -0.4890996430954449);
1187
1188   CPPUNIT_ASSERT(! pol1->isInOrOut(n)); // node should be out
1189   n->decrRef();
1190   delete pol1;
1191 }
1192
1193 void QuadraticPlanarInterpTest::checkGetMiddleOfPoints()
1194 {
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
1201
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);
1205
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);
1209
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);
1213
1214     start->decrRef(); end->decrRef();
1215   }
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
1221
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);
1225
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);
1229
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);
1233
1234     start->decrRef(); end->decrRef();
1235   }
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
1241
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);
1245
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);
1249
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);
1253
1254     start->decrRef(); end->decrRef();
1255   }
1256 }
1257
1258 void QuadraticPlanarInterpTest::checkGetMiddleOfPointsOriented()
1259 {
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
1265
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);
1269
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);
1273
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);
1277
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);
1281
1282     start->decrRef(); end->decrRef();
1283   }
1284 }
1285
1286 }