Salome HOME
[EDF10723] - MEDFileUMesh::linearToQuadratic and MEDFileUMesh::quadraticToLinear
[tools/medcoupling.git] / src / INTERP_KERNELTest / QuadraticPlanarInterpTest5.cxx
index 88b70d2e0feafd919fb5da44bed36da7132bab1d..615969ffbfff9fc3431a25a846dfedfb0ce993ef 100644 (file)
@@ -1,35 +1,39 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
+
 #include "QuadraticPlanarInterpTest.hxx"
-#include "QuadraticPolygon.hxx"
-#include "ElementaryEdge.hxx"
-#include "EdgeArcCircle.hxx"
-#include "EdgeLin.hxx"
+#include "InterpKernelGeo2DQuadraticPolygon.hxx"
+#include "InterpKernelGeo2DElementaryEdge.hxx"
+#include "InterpKernelGeo2DEdgeArcCircle.hxx"
+#include "InterpKernelGeo2DEdgeLin.hxx"
 
 #include <cmath>
 #include <sstream>
 #include <iostream>
 #include <iterator>
 
-using namespace std;
 using namespace INTERP_KERNEL;
 
+namespace INTERP_TEST
+{
+
 class DoubleEqual
 {
 public:
@@ -211,7 +215,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0006()
     0, 1, 2, 3, 4, 5, 6, 7 };
   QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.366519,0.,0.};
   double test2_res[4]={0.,0.,0.,0.366519};
@@ -237,7 +241,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0007()
     0, 1, 2, 3, 4, 5, 6, 7 };
   QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.366519,0.,0.};
   double test2_res[4]={0.,0.,0.,0.366519};
@@ -263,7 +267,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0008()
     0, 1, 2, 3, 4, 5, 6, 7 };
   QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.18326,0.,0.};
   double test2_res[4]={0.,0.,0.,0.18326};
@@ -344,7 +348,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0011()
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val1,1.e-13);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val2,1.e-13);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val3,1.e-13);
-  vector<double> val4,val5;
+  std::vector<double> val4,val5;
   pol1->intersectForPerimeterAdvanced(*pol2,val4,val5);
   double test1_res[4]={0.,0.,0.,0.};
   CPPUNIT_ASSERT(std::equal(val4.begin(),val4.end(),test1_res,DoubleEqual(1e-13)));
@@ -388,7 +392,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar2511()
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val1,1.e-13);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val2,1.e-13);
   CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,val3,1.e-13);
-  vector<double> val4,val5;
+  std::vector<double> val4,val5;
   pol1->intersectForPerimeterAdvanced(*pol2,val4,val5);
   double test1_res[4]={0.,0.,0.,0.};
   CPPUNIT_ASSERT(std::equal(val4.begin(),val4.end(),test1_res,DoubleEqual(1e-13)));
@@ -426,7 +430,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0012()
     0, 1, 2, 3, 4, 5, 6, 7 };
   QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.05,0.};
   double test2_res[4]={0.,0.,0.05,0.};
@@ -434,7 +438,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0012()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -460,7 +464,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0013()
     0, 1, 2, 3, 4, 5, 6, 7 };
   QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   QuadraticPolygon *pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.1,0.};
   double test2_res[4]={0.,0.,0.1,0.};
@@ -468,7 +472,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0013()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -504,7 +508,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0014()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.15,0.};
   double test2_res[4]={0.05,0.,0.1,0.};
@@ -512,7 +516,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0014()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -548,7 +552,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0015()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.2,0.};
   double test2_res[4]={0.1,0.,0.1,0.};
@@ -556,7 +560,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0015()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -592,7 +596,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0016()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.15,0.};
   double test2_res[4]={0.1,0.,0.05,0.};
@@ -600,7 +604,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0016()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -637,7 +641,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0017()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.1,0.};
   double test2_res[4]={0.1,0.,0.,0.};
@@ -645,7 +649,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0017()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -682,7 +686,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0018()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.05,0.};
   double test2_res[4]={0.05,0.,0.,0.};
@@ -690,7 +694,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0018()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -753,7 +757,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0020()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.,0.};
   double test2_res[4]={0.,0.,0.,0.};
@@ -761,7 +765,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0020()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -798,7 +802,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0021()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.162251,0.151523,0.,0.};
   double test2_res[4]={0.,0.311383,0.,0.0978193};
@@ -806,7 +810,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0021()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -942,7 +946,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0025()
   delete pol1;
   delete pol2;
   //
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -977,7 +981,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0026()
   delete pol1;
   delete pol2;
   //
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -1014,7 +1018,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0027()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.222704,0.,0.};
   double test2_res[4]={0.1,0.0465335,0.1,0.092554};
@@ -1022,7 +1026,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0027()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -1059,7 +1063,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0028()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.,0.};
   double test2_res[4]={0.1,0.628319,0.1,0.314159};
@@ -1067,7 +1071,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0028()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -1104,7 +1108,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0029()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.,0.};
   double test2_res[4]={0.,0.,0.,0.};
@@ -1112,7 +1116,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0029()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-13)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -1149,7 +1153,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
   //
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
-  vector<double> val1,val2;
+  std::vector<double> val1,val2;
   pol1->intersectForPerimeterAdvanced(*pol2,val1,val2);
   double test1_res[4]={0.,0.,0.,0.};
   double test2_res[4]={0.1,0.628319,0.1,0.314159};
@@ -1157,7 +1161,7 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
   CPPUNIT_ASSERT(std::equal(val2.begin(),val2.end(),test2_res,DoubleEqual(1e-6)));
   delete pol1;
   delete pol2;
-  vector<int> val3;
+  std::vector<int> val3;
   pol1=buildQuadraticPolygonCoarseInfo(coords,tab8,8);
   pol2=buildQuadraticPolygonCoarseInfo(coords2,tab8,8);
   pol1->intersectForPoint(*pol2,val3);
@@ -1166,3 +1170,117 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
   delete pol1;
   delete pol2;
 }
+
+void QuadraticPlanarInterpTest::checkIsInOrOut()
+{
+  double coords[8]={   0.30662641093707971,  -0.47819928619088981,
+                      -0.47819928619088964,  0.30662641093707987,
+                       0.0, 0.0,
+                       0.4, 0.4
+  };
+  coords[4] = (coords[0] + coords[2]) / 2.0;
+  coords[5] = (coords[1] + coords[3]) / 2.0;
+
+  int tab4[4]={ 0, 1, 2, 3};
+  QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab4,4);
+  Node * n = new Node(0.3175267678416348, -0.4890996430954449);
+
+  CPPUNIT_ASSERT(! pol1->isInOrOut(n)); // node should be out
+  n->decrRef();
+  delete pol1;
+}
+
+void QuadraticPlanarInterpTest::checkGetMiddleOfPoints()
+{
+  { // from testIntersect2DMeshWith1DLine6()
+    double p1[] = {0.51641754716735844, 2.0};
+    double p2[] = {0.0, 1.0};
+    double e_center[] = {-0.71, 2.0};
+    double mid[] = {0.0,0.0}; // out
+    double mide[] = {0.0,0.0}; // expected
+
+    Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
+    // start, end, center_x, center_y, radius, angle0, angle
+    EdgeArcCircle e(start, end, e_center, 1.2264175471673588, -0.9533904350433241, 0.95339043504332388);
+
+    e.getMiddleOfPoints(p1, p2, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.4372640310451197, mid[1], 1.e-7);
+
+    e.getMiddleOfPoints(p2, p1, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.37969180470645592, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.4372640310451197, mid[1], 1.e-7);
+
+    start->decrRef(); end->decrRef();
+  }
+  { // from testSwig2Intersect2DMeshWith1DLine11()
+    double p1[] = {-1., 0.23453685964236054};
+    double p2[] = {-0.23453685964235979, 1.0};
+    double e_center[] = {-4.85, 4.85};
+    double mid[] = {0.0,0.0}; // out
+
+    Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
+    // start, end, center_x, center_y, radius, angle0, angle
+    EdgeArcCircle e(start, end, e_center, 6.0104076400856474, -0.69522150912422953, -0.18035330854643861);
+
+    e.getMiddleOfPoints(p1, p2, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.6, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6, mid[1], 1.e-7);
+
+    e.getMiddleOfPoints(p2, p1, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.6, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6, mid[1], 1.e-7);
+
+    start->decrRef(); end->decrRef();
+  }
+  { // from testSwig2Intersect2DMeshWith1DLine11()
+    double p1[] = {-0.1303327636866019, -1.0};
+    double p2[] = {-1.0, -0.1303327636866019};
+    double e_center[] = {-1.9833333333333298, -1.9833333333333298};
+    double mid[] = {0.0,0.0}; // out
+
+    Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
+    // start, end, center_x, center_y, radius, angle0, angle
+    EdgeArcCircle e(start, end, e_center, 2.0977501175200861, 1.0829141821052615, -0.59503203741562627);
+
+    e.getMiddleOfPoints(p1, p2, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[1], 1.e-7);
+
+    e.getMiddleOfPoints(p2, p1, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5, mid[1], 1.e-7);
+
+    start->decrRef(); end->decrRef();
+  }
+}
+
+void QuadraticPlanarInterpTest::checkGetMiddleOfPointsOriented()
+{
+  { // from testSwig2Colinearize2D3()
+    double p1[] = {-0.70710678118654746, 0.70710678118654757};
+    double p2[] = {-0.70710678118654768, -0.70710678118654746};
+    double e_center[] = {0., 0.};
+    double mid[] = {0.0,0.0}; // out
+
+    Node * start = new Node(0.,0.); Node * end = new Node(0.,0.); // unused
+    // start, end, center_x, center_y, radius, angle0, angle
+    EdgeArcCircle e(start, end, e_center, 1.0, -0.7853981633974485, -1.5707963267948966);
+
+    e.getMiddleOfPointsOriented(p1, p2, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1., mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0., mid[1], 1.e-7);
+
+    e.getMiddleOfPoints(p1, p2, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-1., mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0., mid[1], 1.e-7);
+
+    e.getMiddleOfPointsOriented(p2, p1, mid);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(-1., mid[0], 1.e-7);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(0., mid[1], 1.e-7);
+
+    start->decrRef(); end->decrRef();
+  }
+}
+
+}