]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Thu, 10 Jul 2008 13:45:12 +0000 (13:45 +0000)
committerageay <ageay>
Thu, 10 Jul 2008 13:45:12 +0000 (13:45 +0000)
25 files changed:
src/INTERP_KERNEL/Geometric2D/AbstractEdge.hxx
src/INTERP_KERNEL/Geometric2D/Bounds.cxx
src/INTERP_KERNEL/Geometric2D/Bounds.hxx
src/INTERP_KERNEL/Geometric2D/ComposedEdge.cxx
src/INTERP_KERNEL/Geometric2D/ComposedEdge.hxx
src/INTERP_KERNEL/Geometric2D/Edge.cxx
src/INTERP_KERNEL/Geometric2D/Edge.hxx
src/INTERP_KERNEL/Geometric2D/EdgeArcCircle.cxx
src/INTERP_KERNEL/Geometric2D/EdgeArcCircle.hxx
src/INTERP_KERNEL/Geometric2D/EdgeLin.cxx
src/INTERP_KERNEL/Geometric2D/EdgeLin.hxx
src/INTERP_KERNEL/Geometric2D/ElementaryEdge.cxx
src/INTERP_KERNEL/Geometric2D/ElementaryEdge.hxx
src/INTERP_KERNEL/Geometric2D/Node.cxx
src/INTERP_KERNEL/Geometric2D/Node.hxx
src/INTERP_KERNEL/Geometric2D/Precision.hxx
src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.cxx
src/INTERP_KERNEL/Geometric2D/QuadraticPolygon.hxx
src/INTERP_KERNEL/Test/Makefile.am
src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest.cxx [new file with mode: 0644]
src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest.hxx [new file with mode: 0644]
src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest2.cxx [new file with mode: 0644]
src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest3.cxx [new file with mode: 0644]
src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx [new file with mode: 0644]
src/INTERP_KERNEL/Test/TestInterpKernel.cxx

index ec2e21e5be64c06389a973686dba37df6693ead1..bc36e5ffd825a08e271eea655883c77e96116d2d 100644 (file)
@@ -52,6 +52,7 @@ namespace INTERP_KERNEL
     virtual void reverse() = 0;
     virtual bool completed() const = 0;
     virtual int recursiveSize() const = 0;
+    virtual void initLocations() const = 0;
     virtual AbstractEdge *clone() const = 0;
     virtual bool isNodeIn(Node *n) const = 0;
     virtual double getAreaOfZone() const = 0;
index bd6297221b60de280dbeccfc08c8accadec16900..dbce54efc0999358b270ca4da780f87b36395000 100644 (file)
@@ -1,5 +1,6 @@
 #include "Bounds.hxx"
 #include "InterpolationUtils.hxx"
+#include "EdgeArcCircle.hxx"
 #include "Node.hxx"
 
 #include <cmath>
@@ -38,11 +39,51 @@ double &Bounds::operator[](int i)
   throw Exception("internal error occurs !");
 }
 
+double Bounds::getDiagonal() const
+{
+  double a=_xMax-_xMin;
+  double b=_yMax-_yMin;
+  return sqrt(a*a+b*b);
+}
+
 void Bounds::prepareForAggregation()
 {
   _xMin=1e200; _xMax=-1e200; _yMin=1e200; _yMax=-1e200;
 }
 
+/*! 
+ * Given an arc defined by 'center', 'radius' and 'intrcptArcDelta' in radian, returns (by outputs intrcptArcAngle0 and intrcptArcDelta)
+ * the intercepted angle of 'this' from 'center' point of view.
+ * If diagonal of 'this' is the same order of 2*radius, intrcptArcAngle0 and intrcptArcDelta remains unchanged.
+ * @param center IN parameter.
+ * @param radius IN parameter.
+ * @param intrcptArcAngle0 OUT parameter.
+ * @param intrcptArcDelta IN/OUT parameter.
+ */
+void Bounds::getInterceptedArc(const double *center, double radius, double& intrcptArcAngle0, double& intrcptArcDelta) const
+{
+  double diag=getDiagonal();
+  if(diag<2.*radius)
+    {
+      double v1[2],v2[2],w1[2],w2[2];
+      v1[0]=_xMin-center[0]; v1[1]=_yMax-center[1]; v2[0]=_xMax-center[0]; v2[1]=_yMin-center[1];
+      w1[0]=v1[0]; w1[1]=_yMin-center[1];           w2[0]=v2[0]; w2[1]=_yMax-center[1];
+      double delta1=EdgeArcCircle::safeAsin(v1[0]*v2[1]-v1[1]*v2[0]);
+      double delta2=EdgeArcCircle::safeAsin(w1[0]*w2[1]-w1[1]*w2[0]);
+      double tmp;
+      if(fabs(delta1)>fabs(delta2))
+        {
+          intrcptArcDelta=delta1;
+          intrcptArcAngle0=EdgeArcCircle::getAbsoluteAngle(v1,tmp);
+        }
+      else
+        {
+          intrcptArcDelta=delta2;
+          intrcptArcAngle0=EdgeArcCircle::getAbsoluteAngle(w1,tmp);
+        }
+    }
+}
+
 double Bounds::fitXForXFigD(double val, int res) const
 {
   double delta=fmax(_xMax-_xMin,_yMax-_yMin)/2.;
index 6b3553786826d1d262f24441623feacdd74d94c3..379f30b364271e0b90c36c23994810d9d799f75b 100644 (file)
@@ -20,10 +20,12 @@ namespace INTERP_KERNEL
     Bounds():_xMin(0),_xMax(0.),_yMin(0.),_yMax(0.) { }
     double &operator[](int i);
     const double& operator[](int i) const;
+    double getDiagonal() const;
     Bounds& operator=(const Bounds& other) { _xMin=other._xMin; _xMax=other._xMax; _yMin=other._yMin; _yMax=other._yMax; return *this; }
     Bounds(double xMin, double xMax, double yMin, double yMax):_xMin(xMin),_xMax(xMax),_yMin(yMin),_yMax(yMax) { }
     void setValues(double xMin, double xMax, double yMin, double yMax) { _xMin=xMin; _xMax=xMax; _yMin=yMin; _yMax=yMax; }
     void prepareForAggregation();
+    void getInterceptedArc(const double *center, double radius, double& intrcptArcAngle0, double& intrcptArcDelta) const;
     int fitXForXFig(double val, int res) const { return (int)fitXForXFigD(val,res); }
     int fitYForXFig(double val, int res) const { return (int)fitYForXFigD(val,res); }
     double fitXForXFigD(double val, int res) const;
index 5d7f1eebd398c2eacf810df68b67b10fbf62d2e7..6ea0930e8579137967e9c6f66c0b5acf6d243649 100644 (file)
@@ -49,6 +49,28 @@ void ComposedEdge::setValueAt(int i, Edge *e, bool direction)
   _subEdges[i]=new ElementaryEdge(e,direction);
 }
 
+struct AbsEdgeCmp
+{
+  AbsEdgeCmp(AbstractEdge *b):_b1((ElementaryEdge *)b) { }
+  bool operator()(AbstractEdge *a) { ElementaryEdge *a1=(ElementaryEdge *)a; return a1->getPtr()==_b1->getPtr();}
+
+  ElementaryEdge *_b1;
+};
+
+double ComposedEdge::getCommonLentgthWith(const ComposedEdge& other) const
+{
+  double ret=0.;
+  for(vector<AbstractEdge *>::const_iterator iter=_subEdges.begin();iter!=_subEdges.end();iter++)
+    {
+      if(find_if(other._subEdges.begin(),other._subEdges.end(),AbsEdgeCmp(*iter))!=other._subEdges.end())
+        {
+          const ElementaryEdge *tmp=static_cast<const ElementaryEdge *>(*iter);
+          ret+=tmp->getCurveLength();
+        }
+    }
+  return ret;
+}
+
 void ComposedEdge::clear()
 {
   clearAll(_subEdges.begin());
@@ -82,6 +104,12 @@ int ComposedEdge::recursiveSize() const
   return ret;
 }
 
+void ComposedEdge::initLocations() const
+{
+  for(vector<AbstractEdge *>::const_iterator iter=_subEdges.begin();iter!=_subEdges.end();iter++)
+    (*iter)->initLocations();
+}
+
 AbstractEdge *ComposedEdge::clone() const
 {
   return new ComposedEdge(*this);
index 16a24adf17b442524c5bb035aca88eb550a69c04..5e70afe9035fd092b6fb59eb09f1c62c65e39288 100644 (file)
@@ -16,6 +16,7 @@ namespace INTERP_KERNEL
     static void Delete(ComposedEdge *pt) { delete pt; }
     void reverse();
     int recursiveSize() const;
+    void initLocations() const;
     AbstractEdge *clone() const;
     bool isNodeIn(Node *n) const;
     double getAreaOfZone() const;
@@ -27,6 +28,7 @@ namespace INTERP_KERNEL
     ElementaryEdge * &getFirstElementary(IteratorOnComposedEdge::ItOnFixdLev &delta);
     void setValueAt(int i, AbstractEdge *val) { delete _subEdges[i]; _subEdges[i]=val; }
     void setValueAt(int i, Edge *e, bool direction=true);
+    double getCommonLentgthWith(const ComposedEdge& other) const;
     void clear();
     bool empty() const { return _subEdges.empty(); }
     AbstractEdge *front() const { return _subEdges.front(); }
index b860bc287227d7fb590d93e6bc58aa36b3c298cf..b6948063672bbb5f04acf6b47702deaa94a1edaf 100644 (file)
@@ -3,6 +3,7 @@
 #include "EdgeInfLin.hxx"
 //#include "EdgeParabol.hxx"
 #include "EdgeArcCircle.hxx"
+#include "InterpolationUtils.hxx"
 
 using namespace std;
 using namespace INTERP_KERNEL;
@@ -498,6 +499,20 @@ void Edge::addSubEdgeInVector(Node *start, Node *end, ComposedEdge& vec) const
   vec.pushBack(buildEdgeLyingOnMe(start,end,true));
 }
 
+/*!
+ * Retrieves a vector 'vectOutput' that is normal to 'this'. 'vectOutput' is normalized.
+ */
+void Edge::getNormalVector(double *vectOutput) const
+{
+  copy((const double *)(*_end),(const double *)(*_end)+2,vectOutput);
+  transform(vectOutput,vectOutput+2,(const double *)(*_start),vectOutput,minus<double>());
+  double norm=1./Node::norm(vectOutput);
+  transform(vectOutput,vectOutput+2,vectOutput,bind2nd(multiplies<double>(),norm));
+  double tmp=vectOutput[0];
+  vectOutput[0]=vectOutput[1];
+  vectOutput[1]=-tmp;
+}
+
 Edge *Edge::buildEdgeFrom(Node *start, Node *end)
 {
   return new EdgeLin(start,end);
@@ -540,6 +555,58 @@ bool Edge::intersectWith(const Edge *other, MergePoints& commonNode,
   return ret;
 }
 
+bool Edge::intersectOverlapped(const Edge *f1, const Edge *f2, Intersector *intersector, MergePoints& commonNode,
+                               ComposedEdge& outValForF1, ComposedEdge& outValForF2)
+{
+  bool rev=intersector->haveTheySameDirection();
+  Node *f2Start=f2->getNode(rev?START:END);
+  Node *f2End=f2->getNode(rev?END:START);
+  TypeOfLocInEdge place1, place2;
+  intersector->getPlacements(f2Start,f2End,place1,place2,commonNode);
+  int codeForIntersectionCase=combineCodes(place1,place2);
+  return splitOverlappedEdges(f1,f2,f2Start,f2End,rev,codeForIntersectionCase,outValForF1,outValForF2);
+}
+
+/*!
+ * Perform 1D linear interpolation. Warning distrib1 and distrib2 are expected to be in ascending mode.
+ */
+void Edge::interpolate1DLin(const std::vector<double>& distrib1, const std::vector<double>& distrib2, std::map<int, std::map<int,double> >& result)
+{
+  int nbOfV1=distrib1.size()-1;
+  int nbOfV2=distrib2.size()-1;
+  Node *n1=new Node(0.,0.); Node *n3=new Node(0.,0.);
+  Node *n2=new Node(0.,0.); Node *n4=new Node(0.,0.);
+  MergePoints commonNode;
+  for(int i=0;i<nbOfV1;i++)
+    {
+      vector<double>::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(greater_equal<double>(),distrib1[i]));
+      if(iter!=distrib2.end())
+        {
+          for(int j=(iter-1)-distrib2.begin();j<nbOfV2;j++)
+            {
+              if(distrib2[j]<=distrib1[i+1])
+                {
+                  EdgeLin *e1=new EdgeLin(n1,n2); EdgeLin *e2=new EdgeLin(n3,n4);
+                  n1->setNewCoords(distrib1[i],0.); n2->setNewCoords(distrib1[i+1],0.);
+                  n3->setNewCoords(distrib2[j],0.); n4->setNewCoords(distrib2[j+1],0.);
+                  ComposedEdge *f1=new ComposedEdge;
+                  ComposedEdge *f2=new ComposedEdge;
+                  SegSegIntersector inters(*e1,*e2);
+                  bool b1,b2;
+                  inters.areOverlappedOrOnlyColinears(0,b1,b2);
+                  if(intersectOverlapped(e1,e2,&inters,commonNode,*f1,*f2))
+                    {
+                      result[i][j]=f1->getCommonLentgthWith(*f2)/e1->getCurveLength();
+                    }
+                  ComposedEdge::Delete(f1); ComposedEdge::Delete(f2);
+                  e1->decrRef(); e2->decrRef();
+                }
+            }
+        }
+    }
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef();
+}
+
 Intersector *Edge::buildIntersectorWith(const Edge *e1, const Edge *e2)
 {
   Intersector *ret=0;
@@ -575,15 +642,7 @@ bool Edge::intersect(const Edge *f1, const Edge *f2, Intersector *intersector, c
   bool areOverlapped;
   intersector->areOverlappedOrOnlyColinears(whereToFind,obviousNoIntersection,areOverlapped);
   if(areOverlapped)
-    {
-      bool rev=intersector->haveTheySameDirection();
-      Node *f2Start=f2->getNode(rev?START:END);
-      Node *f2End=f2->getNode(rev?END:START);
-      TypeOfLocInEdge place1, place2;
-      intersector->getPlacements(f2Start,f2End,place1,place2,commonNode);
-      int codeForIntersectionCase=combineCodes(place1,place2);
-      return splitOverlappedEdges(f1,f2,f2Start,f2End,rev,codeForIntersectionCase,outValForF1,outValForF2);
-    }
+    return intersectOverlapped(f1,f2,intersector,commonNode,outValForF1,outValForF2);
   if(obviousNoIntersection)
     return false;
   vector<Node *> newNodes;
index 2a72b6c3949e9c219e348b302ac3e6433bb29674..7496325f787c286015fd21d7bf9b57f3990f28bb 100644 (file)
@@ -1,14 +1,15 @@
 #ifndef __EDGE_HXX__
 #define __EDGE_HXX__
 
-#include "InterpolationUtils.hxx"
 #include "ComposedEdge.hxx"
+#include "InterpolationUtils.hxx"
 #include "Bounds.hxx"
 #include "Node.hxx"
 
 #include <iostream>
 #include <vector>
 #include <list>
+#include <map>
 
 namespace INTERP_KERNEL
 {
@@ -165,6 +166,7 @@ namespace INTERP_KERNEL
     TypeOfEdgeLocInPolygon getLoc() const { return _loc; }
     void incrRef() const { _cnt++; }
     bool decrRef();
+    void initLocs() const { _loc=FULL_UNKNOWN; _start->initLocs(); _end->initLocs(); }
     void declareOn() const;
     void declareIn() const;
     void declareOut() const;
@@ -180,6 +182,7 @@ namespace INTERP_KERNEL
     bool changeEndNodeWith(Node *otherEndNode) const;
     bool changeEndNodeWithAndKeepTrack(Node *otherEndNode, std::vector<Node *>& track) const;
     void addSubEdgeInVector(Node *start, Node *end, ComposedEdge& vec) const;
+    void getNormalVector(double *vectOutput) const;
     static Intersector *buildIntersectorWith(const Edge *e1, const Edge *e2);
     static Edge *buildFromXfigLine(std::istream& str);
     static Edge *buildEdgeFrom(Node *start, Node *end);
@@ -188,6 +191,7 @@ namespace INTERP_KERNEL
     virtual void update(Node *m) = 0;
     //! returns area between this and axe Ox delimited along Ox by _start and _end.
     virtual double getAreaOfZone() const = 0;
+    //! return the length of arc. Value is always > 0. !
     virtual double getCurveLength() const = 0;
     virtual void getBarycenter(double *bary) const = 0;
     //! Retrieves a point that is owning to this, well placed for IN/OUT detection of this. Typically midlle of this is returned.
@@ -198,12 +202,20 @@ namespace INTERP_KERNEL
     virtual bool isLower(double val1, double val2) const = 0;
     //! node is expected to lay on 'this'. It returns a characteristic magnitude usable by isIn method.
     virtual double getCharactValue(const Node& node) const = 0;
+    //! retrieves the distance to this : The min distance from pt and any point of this.
+    virtual double getDistanceToPoint(const double *pt) const = 0;
+    //! return if node with coords 'coordOfNode' is on this (with precision).
+    virtual bool isNodeLyingOn(const double *coordOfNode) const = 0;
     virtual TypeOfFunction getTypeOfFunc() const = 0;
     virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0;
     virtual void dynCastFunction(const EdgeLin * &seg,
                                  const EdgeArcCircle * &arcSeg) const = 0;
     bool intersectWith(const Edge *other, MergePoints& commonNode,
                        ComposedEdge& outVal1, ComposedEdge& outVal2) const;
+    static bool intersectOverlapped(const Edge *f1, const Edge *f2, Intersector *intersector, MergePoints& commonNode,
+                                    ComposedEdge& outValForF1, ComposedEdge& outValForF2);
+    static void interpolate1DLin(const std::vector<double>& distrib1, const std::vector<double>& distrib2,
+                                 std::map<int, std::map<int,double> >& result);
     virtual void dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const = 0;
   protected:
     Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { }
index 9b91e860ec75e1d491ddcd2e312385ab4c8098fe..188aa66c4f1d65f4a982c22aa279413cdff107cd 100644 (file)
@@ -90,6 +90,52 @@ double ArcCArcCIntersector::getAngle(Node *node) const
   return ret;
 }
 
+bool ArcCArcCIntersector::areArcsOverlapped(const EdgeArcCircle& a1, const EdgeArcCircle& a2)
+{
+  double centerL[2],radiusL,angle0L,angleL;
+  double centerB[2],radiusB;
+  double lgth1=fabs(a1.getAngle()*a1.getRadius());
+  double lgth2=fabs(a2.getAngle()*a2.getRadius());
+  if(lgth1<lgth2)
+    {//a1 is the little one ('L') and a2 the big one ('B')
+      a1.getCenter(centerL); radiusL=a1.getRadius(); angle0L=a1.getAngle0(); angleL=a1.getAngle();
+      a2.getCenter(centerB); radiusB=a2.getRadius();
+    }
+  else
+    {
+      a2.getCenter(centerL); radiusL=a2.getRadius(); angle0L=a2.getAngle0(); angleL=a2.getAngle();
+      a1.getCenter(centerB); radiusB=a1.getRadius();
+    }
+  // dividing from the begining by radiusB^2 to keep precision
+  double tmp=Node::distanceBtw2PtSq(centerL,centerB);
+  double cst=tmp/(radiusB*radiusB);
+  cst+=radiusL*radiusL/(radiusB*radiusB);
+  if(!Node::areDoubleEqualsWP(cst,1.,2.))
+    return false;
+  //
+  Bounds *merge=a1.getBounds().nearlyAmIIntersectingWith(a2.getBounds());
+  merge->getInterceptedArc(centerL,radiusL,angle0L,angleL);
+  delete merge;
+  //
+  tmp=sqrt(tmp);
+  double phi=EdgeArcCircle::safeAcos((centerL[0]-centerB[0])/tmp);
+  if(centerL[1]<centerB[1])
+    phi=-phi;
+  double cst2=2*radiusL*tmp/(radiusB*radiusB);
+  double cmpContainer[4];
+  int sizeOfCmpContainer=2;
+  cmpContainer[0]=cst+cst2*cos(phi-angle0L);
+  cmpContainer[1]=cst+cst2*cos(phi-angle0L+angleL);
+  double a=normalizeAngle(phi-angle0L);
+  if(isIn2Pi(angle0L,angleL,a))
+    cmpContainer[sizeOfCmpContainer++]=cst+cst2;
+  a=normalizeAngle(phi-angle0L+M_PI);
+  if(isIn2Pi(angle0L,angleL,a))
+    cmpContainer[sizeOfCmpContainer++]=cst-cst2;
+  a=*max_element(cmpContainer,cmpContainer+sizeOfCmpContainer);
+  return Node::areDoubleEqualsWP(a,1.,2.);
+}
+
 void ArcCArcCIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped)
 {
   _dist=Node::distanceBtw2Pt(getE1().getCenter(),getE2().getCenter());
@@ -100,7 +146,7 @@ void ArcCArcCIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind
       areOverlapped=false;
       return ;
     }
-  if(Node::areDoubleEquals(_dist,0.) && Node::areDoubleEquals(radius1,radius2))
+  if(areArcsOverlapped(getE1(),getE2()))//(Node::areDoubleEquals(_dist,0.) && Node::areDoubleEquals(radius1,radius2))
     {
       obviousNoIntersection=false;
       areOverlapped=true;
@@ -300,8 +346,8 @@ void ArcCSegIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind,
   _cross=
     ((*(_e2.getStartNode()))[0]-center[0])*((*(_e2.getEndNode()))[1]-center[1])-
     ((*(_e2.getStartNode()))[1]-center[1])*((*(_e2.getEndNode()))[0]-center[0]);
-  _determinant=getE1().getRadius()*getE1().getRadius()*_drSq-_cross*_cross;
-  if(_determinant>-QUADRATIC_PLANAR::_precision*10.)//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
+  _determinant=getE1().getRadius()*getE1().getRadius()/_drSq-_cross*_cross/(_drSq*_drSq);
+  if(_determinant>-2*QUADRATIC_PLANAR::_precision)//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
     obviousNoIntersection=false;
   else
     obviousNoIntersection=true;   
@@ -316,11 +362,11 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic
 {
   std::list< IntersectElement > ret;
   const double *center=getE1().getCenter();
-  if(!(fabs(_determinant)<(QUADRATIC_PLANAR::_precision*10.)))//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
+  if(!(fabs(_determinant)<(2.*QUADRATIC_PLANAR::_precision)))//QUADRATIC_PLANAR::_precision*QUADRATIC_PLANAR::_precision*_drSq*_drSq/(2.*_dx*_dx))
     {
       double determinant=EdgeArcCircle::safeSqrt(_determinant);
-      double x1=(_cross*_dy+Node::sign(_dy)*_dx*determinant)/_drSq+center[0];
-      double y1=(-_cross*_dx+fabs(_dy)*determinant)/_drSq+center[1];
+      double x1=(_cross*_dy/_drSq+Node::sign(_dy)*_dx*determinant)+center[0];
+      double y1=(-_cross*_dx/_drSq+fabs(_dy)*determinant)+center[1];
       Node *intersect1=new Node(x1,y1); intersect1->declareOn();
       bool i1_1S=_e1.getStartNode()->isEqual(*intersect1);
       bool i1_1E=_e1.getEndNode()->isEqual(*intersect1);
@@ -328,8 +374,8 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic
       bool i1_2E=_e2.getEndNode()->isEqual(*intersect1);
       ret.push_back(IntersectElement(getE1().getCharactValue(*intersect1),getE2().getCharactValue(*intersect1),i1_1S,i1_1E,i1_2S,i1_2E,intersect1,_e1,_e2,keepOrder()));
       //
-      double x2=(_cross*_dy-Node::sign(_dy)*_dx*determinant)/_drSq+center[0];
-      double y2=(-_cross*_dx-fabs(_dy)*determinant)/_drSq+center[1];
+      double x2=(_cross*_dy/_drSq-Node::sign(_dy)*_dx*determinant)+center[0];
+      double y2=(-_cross*_dx/_drSq-fabs(_dy)*determinant)+center[1];
       Node *intersect2=new Node(x2,y2); intersect2->declareOn();
       bool i2_1S=_e1.getStartNode()->isEqual(*intersect2);
       bool i2_1E=_e1.getEndNode()->isEqual(*intersect2);
@@ -414,6 +460,15 @@ Edge *EdgeArcCircle::buildEdgeLyingOnMe(Node *start, Node *end, bool direction)
   return new EdgeArcCircle(start,end,_center,_radius,angle0,deltaAngle,direction);
 }
 
+double EdgeArcCircle::getAbsoluteAngle(const double *vect, double& normVect)
+{
+  normVect=Node::norm(vect);
+  double ret=safeAcos(vect[0]/normVect);
+  if(vect[1]<0)
+    ret=-ret;
+  return ret;
+}
+
 void EdgeArcCircle::getArcOfCirclePassingThru(const double *start, const double *middle, const double *end, 
                                               double *center, double& radius, double& angleInRad, double& angleInRad0)
 {
@@ -473,8 +528,8 @@ double EdgeArcCircle::getCurveLength() const
 
 void EdgeArcCircle::getBarycenter(double *bary) const
 {
-  bary[0]=((*_start)[0]+(*_end)[0])/2.;
-  bary[1]=((*_start)[1]+(*_end)[1])/2.;
+  bary[0]=_center[0]+_radius*cos(_angle0+_angle/2.);
+  bary[1]=_center[1]+_radius*sin(_angle0+_angle/2.);
 }
 
 /*!
@@ -524,6 +579,31 @@ double EdgeArcCircle::getCharactValue(const Node& node) const
   return angle0;
 }
 
+double EdgeArcCircle::getDistanceToPoint(const double *pt) const
+{
+  double angle=Node::computeAngle(_center,pt);
+  if(ArcCArcCIntersector::isIn2Pi(_angle0,_angle,angle))
+    return fabs(Node::distanceBtw2Pt(_center,pt)-_radius);
+  else
+    {
+      double dist1=Node::distanceBtw2Pt(*_start,pt);
+      double dist2=Node::distanceBtw2Pt(*_end,pt);
+      return fmin(dist1,dist2);
+    }
+}
+
+bool EdgeArcCircle::isNodeLyingOn(const double *coordOfNode) const
+{
+  double dist=Node::distanceBtw2Pt(_center,coordOfNode);
+  if(Node::areDoubleEquals(dist,_radius))
+    {
+      double angle=Node::computeAngle(_center,coordOfNode);
+      return ArcCArcCIntersector::isIn2Pi(_angle0,_angle,angle);
+    }
+  else
+    return false;
+}
+
 void EdgeArcCircle::updateBounds()
 {
   _bounds.setValues(fmin((*_start)[0],(*_end)[0]),fmax((*_start)[0],(*_end)[0]),fmin((*_start)[1],(*_end)[1]),fmax((*_start)[1],(*_end)[1]));
index d8868d231c9c44331cc34174ea55aabb3bf7b27c..37b78bbc3275b3b4003dfe09d5e19e93b95b574a 100644 (file)
@@ -17,6 +17,7 @@ namespace INTERP_KERNEL
   private:
     //! return angle in ]-Pi;Pi[ - 'node' must be on curve of '_e1'
     double getAngle(Node *node) const;
+    static bool areArcsOverlapped(const EdgeArcCircle& a1, const EdgeArcCircle& a2);
     static bool isIn2Pi(double start, double delta, double angleIn);
     //! 'delta' 'start' in ]-Pi;Pi[
     static bool isAngleNotIn(double start, double delta, double angleIn);
@@ -66,6 +67,8 @@ namespace INTERP_KERNEL
     Node *buildRepresentantOfMySelf() const;
     bool isLower(double val1, double val2) const;
     double getCharactValue(const Node& node) const;
+    double getDistanceToPoint(const double *pt) const;
+    bool isNodeLyingOn(const double *coordOfNode) const;
     TypeOfFunction getTypeOfFunc() const { return ARC_CIRCLE; }
     void dynCastFunction(const EdgeLin * &seg,
                          const EdgeArcCircle * &arcSeg) const { arcSeg=this; }
@@ -76,11 +79,13 @@ namespace INTERP_KERNEL
     double getAngle0() const { return _angle0; }
     double getRadius() const { return _radius; }
     double getAngle() const { return _angle; }
+    static double getAbsoluteAngle(const double *vect, double& normVect);
     static void getArcOfCirclePassingThru(const double *start, const double *middle, const double *end, 
                                           double *center, double& radius, double& angleInRad, double& angleInRad0);
     //! To avoid in aggressive optimizations nan.
     static double safeSqrt(double val) { double ret=fmax(val,0.); return sqrt(ret); }
     static double safeAcos(double cosAngle) { double ret=fmin(cosAngle,1.); ret=fmax(ret,-1.); return acos(ret); }
+    static double safeAsin(double sinAngle) { double ret=fmin(sinAngle,1.); ret=fmax(ret,-1.); return asin(ret); }
   protected:
     void updateBounds();
   protected:
index fd4b86178675e8f025e4a93013de3ed4f92a781d..4547332cc0e7a71da99a0610f78cdb50b163f185 100644 (file)
@@ -31,7 +31,8 @@ SegSegIntersector::SegSegIntersector(const EdgeLin& e1, const EdgeLin& e2):SameT
  */
 bool SegSegIntersector::haveTheySameDirection() const
 {
-  return (_matrix[_ind?1:0]>0. && _matrix[_ind?3:2]>0.) || (_matrix[_ind?1:0]<0. && _matrix[_ind?3:2]<0.);
+  return (_matrix[3]*_matrix[1]+_matrix[2]*_matrix[0])>0.;
+  //return (_matrix[_ind?1:0]>0. && _matrix[_ind?3:2]>0.) || (_matrix[_ind?1:0]<0. && _matrix[_ind?3:2]<0.);
 }
 
 /*!
@@ -157,9 +158,33 @@ Node *EdgeLin::buildRepresentantOfMySelf() const
 
 double EdgeLin::getCharactValue(const Node& node) const
 {
-  double car1_1x=node[0]-(*(_start))[0]; double car1_2x=(*(_end))[0]-(*(_start))[0];
-  double car1_1y=node[1]-(*(_start))[1]; double car1_2y=(*(_end))[1]-(*(_start))[1];
-  return (car1_1x*car1_2x+car1_1y*car1_2y)/(car1_2x*car1_2x+car1_2y*car1_2y);
+  return getCharactValueEng(node);
+}
+
+double EdgeLin::getDistanceToPoint(const double *pt) const
+{
+  double loc=getCharactValueEng(pt);
+  if(loc>0. && loc<1.)
+    {
+      double tmp[2];
+      tmp[0]=(*_start)[0]*(1-loc)+loc*(*_end)[0];
+      tmp[1]=(*_start)[1]*(1-loc)+loc*(*_end)[1];
+      return Node::distanceBtw2Pt(pt,tmp);
+    }
+  else
+    {
+      double dist1=Node::distanceBtw2Pt(*_start,pt);
+      double dist2=Node::distanceBtw2Pt(*_end,pt);
+      return fmin(dist1,dist2);
+    }
+}
+
+bool EdgeLin::isNodeLyingOn(const double *coordOfNode) const
+{
+  double dBase=sqrt(_start->distanceWithSq(*_end));
+  double d1=Node::distanceBtw2Pt(*_start,coordOfNode);
+  d1+=Node::distanceBtw2Pt(*_end,coordOfNode);
+  return Node::areDoubleEquals(dBase,d1);
 }
 
 void EdgeLin::dumpInXfigFile(std::ostream& stream, bool direction, int resolution, const Bounds& box) const
@@ -212,3 +237,10 @@ void EdgeLin::updateBounds()
 {
   _bounds.setValues(fmin((*_start)[0],(*_end)[0]),fmax((*_start)[0],(*_end)[0]),fmin((*_start)[1],(*_end)[1]),fmax((*_start)[1],(*_end)[1]));
 }
+
+double EdgeLin::getCharactValueEng(const double *node) const
+{
+  double car1_1x=node[0]-(*(_start))[0]; double car1_2x=(*(_end))[0]-(*(_start))[0];
+  double car1_1y=node[1]-(*(_start))[1]; double car1_2y=(*(_end))[1]-(*(_start))[1];
+  return (car1_1x*car1_2x+car1_1y*car1_2y)/(car1_2x*car1_2x+car1_2y*car1_2y);
+}
index 23cde49822956dc5e2ebc898b28f51f748fa2382..eccec23a3ae9ddd5308c6e211f59075e01ce8003 100644 (file)
@@ -42,7 +42,10 @@ namespace INTERP_KERNEL
     bool isIn(double characterVal) const;
     Node *buildRepresentantOfMySelf() const;
     double getCharactValue(const Node& node) const;
+    double getDistanceToPoint(const double *pt) const;
+    bool isNodeLyingOn(const double *coordOfNode) const;
     bool isLower(double val1, double val2) const { return val1<val2; }
+    double getCharactValueEng(const double *node) const;
     bool doIHaveSameDirectionAs(const Edge& other) const;
     Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const;
     void dynCastFunction(const EdgeLin * &seg,
index be84a880b6fa13dad3b69efe583473ac36e62e40..1d2cf014bb5f1054cb515627788b7ab6ce24363a 100644 (file)
@@ -1,4 +1,5 @@
 #include "ElementaryEdge.hxx"
+#include "InterpolationUtils.hxx"
 #include "Edge.hxx"
 
 using namespace INTERP_KERNEL;
@@ -41,6 +42,11 @@ AbstractEdge *ElementaryEdge::clone() const
   return new ElementaryEdge(*this);
 }
 
+void ElementaryEdge::initLocations() const
+{
+  _ptr->initLocs();
+}
+
 int ElementaryEdge::recursiveSize() const
 {
   return 1;
index ae2dab9361858d788a1ef2211ba4ea2a918f68d6..218fca9e3defb2bd2c73b27f7eb37a00ee82fb6f 100644 (file)
@@ -29,6 +29,7 @@ namespace INTERP_KERNEL
     void getBarycenter(double *bary, double& weigh) const;
     double getAreaOfZoneFast() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
     AbstractEdge *clone() const;
+    void initLocations() const;
     int recursiveSize() const;
     int size() const;
     TypeOfEdgeLocInPolygon locateFullyMySelfAbsolute(const ComposedEdge& pol) const;
index 1f88b6d94187fba5ffb0ab60ea6607f299566502..4afeb667f12937bfee54646a5f4217d774ab6d7f 100644 (file)
@@ -52,14 +52,7 @@ bool Node::isEqual(const Node& other) const
 
 double Node::getSlope(const Node& other) const
 {
-  double x=other[0]-(*this)[0];
-  double y=other[1]-(*this)[1];
-  double norm=sqrt(x*x+y*y);
-  double ret=EdgeArcCircle::safeAcos(fabs(x)/norm);
-  if( (x>=0. && y>=0.) || (x<0. && y<0.) )
-    return ret;
-  else
-    return M_PI-ret;
+  return computeSlope(*this, other);
 }
 
 /*!
@@ -83,3 +76,36 @@ double Node::distanceWithSq(const Node& other) const
 {
   return (_coords[0]-other._coords[0])*(_coords[0]-other._coords[0])+(_coords[1]-other._coords[1])*(_coords[1]-other._coords[1]);
 }
+
+/*!
+ * WARNING different from 'computeAngle' method ! The returned value are not in the same interval !
+ * Here in -Pi/2; Pi/2. Typically this method returns the same value by exchanging pt1 and pt2.
+ * Use in process of detection of a point in or not in polygon.
+ */
+double Node::computeSlope(const double *pt1, const double *pt2)
+{
+  double x=pt2[0]-pt1[0];
+  double y=pt2[1]-pt1[1];
+  double norm=sqrt(x*x+y*y);
+  double ret=EdgeArcCircle::safeAcos(fabs(x)/norm);
+  if( (x>=0. && y>=0.) || (x<0. && y<0.) )
+    return ret;
+  else
+    return M_PI-ret;
+}
+
+/*!
+ * WARNING different from 'computeSlope' method. Here angle in -Pi;Pi is returned.
+ * This method is anti-symetric.
+ */
+double Node::computeAngle(const double *pt1, const double *pt2)
+{
+  double x=pt2[0]-pt1[0];
+  double y=pt2[1]-pt1[1];
+  double norm=sqrt(x*x+y*y);
+  double ret=EdgeArcCircle::safeAcos(x/norm);
+  if(y>=0)
+    return ret;
+  else
+    return -ret;
+}
index 5c5c9fadff70c42332a10a8289aa7efe075f0a1c..01e7b839b8dc1030de40a76271fe9a5a5acad318 100644 (file)
@@ -32,6 +32,7 @@ namespace INTERP_KERNEL
     Node(std::istream& stream);
     void incrRef() const { _cnt++; }
     bool decrRef();
+    void initLocs() const { _loc=UNKNOWN; }
     TypeOfLocInPolygon getLoc() const { return _loc; }
     void declareIn() const { if(_loc==UNKNOWN) _loc=IN_1; }
     void declareOn() const { if(_loc==UNKNOWN) _loc=ON_1; }
@@ -40,18 +41,26 @@ namespace INTERP_KERNEL
     void declareOnTangent() { _loc=ON_TANG_1; }
     operator const double*() const { return _coords; }
     bool isEqual(const Node& other) const;
+    //returns an angle in -Pi/2;Pi/2.
     double getSlope(const Node& other) const;
     bool isEqualAndKeepTrack(const Node& other, std::vector<Node *>& track) const;
     void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
     double distanceWithSq(const Node& other) const;
     double operator[](int i) const { return _coords[i]; }
-    //!for tests only !
+    //! use with caution
     void setNewCoords(double x, double y) { _coords[0]=x; _coords[1]=y; }
+    //returns an angle in -Pi/2;Pi/2.
+    static double computeSlope(const double *pt1, const double *pt2);
+    //returns an angle in -Pi;Pi
+    static double computeAngle(const double *pt1, const double *pt2);
+    static double dot(const double *vect1, const double *vect2) { return vect1[0]*vect2[0]+vect1[1]*vect2[1]; }
     static double sign(double val) { if(val>=0) return 1.; else return -1.; }
+    static double norm(const double *vect) { return sqrt(vect[0]*vect[0]+vect[1]*vect[1]); }
     static bool areDoubleEquals(double a, double b) { return fabs(a-b) < QUADRATIC_PLANAR::_precision; }
     //! idem areDoubleEquals except that precision of comparison is modified.
     static bool areDoubleEqualsWP(double a, double b, double k) { return fabs(a-b) < k*QUADRATIC_PLANAR::_precision; }
     static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); }
+    static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); }
   protected:
     ~Node();
   protected:
index 9eb3d275ee8c395b4d71a19fba28812804cb3899..a71150c8145c7c92d56a16baa3a4a6292931731a 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef __PRECISION_HXX__
+#define __PRECISION_HXX__
+
 namespace INTERP_KERNEL
 {
   class QUADRATIC_PLANAR
@@ -9,3 +12,5 @@ namespace INTERP_KERNEL
     static void setArcDetectionPrecision(double precision);
   };
 }
+
+#endif
index c12a58678ddb266cc52755de2e881c211d803f1c..64ce89abc321ba4f03749a1da48454f7f8c34aa2 100644 (file)
@@ -7,6 +7,7 @@
 #include "Edge.txx"
 
 #include <fstream>
+#include <iomanip>
 
 using namespace std;
 using namespace INTERP_KERNEL;
@@ -78,6 +79,20 @@ QuadraticPolygon *QuadraticPolygon::buildArcCirclePolygon(std::vector<Node *>& n
   return ret;
 }
 
+void QuadraticPolygon::buildDbgFile(const std::vector<Node *>& nodes, const char *fileName)
+{
+  ofstream file(fileName);
+  file << setprecision(16);
+  file << "  double coords[]=" << endl << "    { ";
+  for(vector<Node *>::const_iterator iter=nodes.begin();iter!=nodes.end();iter++)
+    {
+      if(iter!=nodes.begin())
+        file << "," << endl << "      ";
+      file << (*(*iter))[0] << ", " << (*(*iter))[1];
+    }
+  file << "};" << endl;
+}
+
 void QuadraticPolygon::closeMe() const
 {
   if(!front()->changeStartNodeWith(back()->getEndNode()))
@@ -357,7 +372,10 @@ bool QuadraticPolygon::amIAChanceToBeCompletedBy(const QuadraticPolygon& pol1Spl
       else
         {
           direction=true;
-          return pol2NotSplitted.isInOrOut(cur->getEndNode());
+         Node *repr=cur->getPtr()->buildRepresentantOfMySelf();
+          bool ret=pol2NotSplitted.isInOrOut(repr);
+         repr->decrRef();
+         return ret;
         }
     }
   else
index 9096db02d7a9575150a7b92dd081e993c46c02cc..60f3129372f983ce34d2d376562c663ef64f34d4 100644 (file)
@@ -18,6 +18,7 @@ namespace INTERP_KERNEL
     QuadraticPolygon(const char *fileName);
     static QuadraticPolygon *buildLinearPolygon(std::vector<Node *>& nodes);
     static QuadraticPolygon *buildArcCirclePolygon(std::vector<Node *>& nodes);
+    static void buildDbgFile(const std::vector<Node *>& nodes, const char *fileName);
     ~QuadraticPolygon();
     void closeMe() const;
     void circularPermute();
index f1f1087289ecfd89990026f78364433f4eb8b51c..3ade2cabc619f8701239ab8b84294951d0099319 100644 (file)
@@ -30,25 +30,31 @@ salomeinclude_HEADERS = CppUnitTest.hxx \
                 InterpolationTestSuite.hxx \
                 SingleElementTetraTests.hxx \
                 MultiElementTetraTests.hxx \
-          HexaTests.hxx \
+                HexaTests.hxx \
                 MeshTestToolkit.hxx \
                 BBTreeTest.hxx \
                 RemapperTest.hxx \
                 SingleElementPlanarTests.hxx \
                 MultiElement2DTests.hxx \
-                InterpolationPlanarTestSuite.hxx       
+                InterpolationPlanarTestSuite.hxx \
+                QuadraticPlanarInterpTest.hxx
 
 EXTRA_DIST += BasicMainTest.hxx
 
 dist_libInterpKernelTest_la_SOURCES= \
-     CppUnitTest.cxx \
-     TransformedTriangleTest.cxx \
-     TransformedTriangleIntersectTest.cxx \
-     BBTreeTest.cxx \
-                RemapperTest.cxx \
-                SingleElementPlanarTests.cxx \
-     PointLocatorTest.cxx \
-                MEDMeshMaker.cxx
+       CppUnitTest.cxx \
+       TransformedTriangleTest.cxx \
+       TransformedTriangleIntersectTest.cxx \
+       BBTreeTest.cxx \
+       RemapperTest.cxx \
+       SingleElementPlanarTests.cxx \
+       PointLocatorTest.cxx \
+       MEDMeshMaker.cxx \
+       QuadraticPlanarInterpTest.cxx \
+       QuadraticPlanarInterpTest2.cxx \
+       QuadraticPlanarInterpTest3.cxx \
+       QuadraticPlanarInterpTest4.cxx
+
 
 libInterpKernelTest_la_CPPFLAGS= @CPPUNIT_INCLUDES@ $(MED2_INCLUDES) $(HDF5_INCLUDES) \
        -I$(srcdir)/.. -I$(srcdir)/../../MEDWrapper/V2_1/Core -I$(srcdir)/../../MEDMEM  -I$(srcdir)/../Geometric2D -DOPTIMIZE -DLOG_LEVEL=0
diff --git a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest.cxx b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest.cxx
new file mode 100644 (file)
index 0000000..d57cd61
--- /dev/null
@@ -0,0 +1,857 @@
+#include "QuadraticPlanarInterpTest.hxx"
+#include "QuadraticPolygon.hxx"
+#include "EdgeArcCircle.hxx"
+#include "ElementaryEdge.hxx"
+#include "ComposedEdge.hxx"
+#include "EdgeLin.hxx"
+
+#include <sstream>
+#include <iostream>
+
+using namespace std;
+using namespace INTERP_KERNEL;
+
+static const double ADMISSIBLE_ERROR = 1.e-14;
+
+void QuadraticPlanarInterpTest::setUp()
+{
+}
+
+void QuadraticPlanarInterpTest::tearDown()
+{
+}
+
+void QuadraticPlanarInterpTest::cleanUp()
+{
+}
+
+void QuadraticPlanarInterpTest::ReadWriteInXfigElementary()
+{
+  //Testing bounds calculation. For Seg2
+  istringstream stream("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4700");
+  EdgeLin *e1=new EdgeLin(stream);
+  Bounds bound=e1->getBounds();
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,bound[2],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.47,bound[3],ADMISSIBLE_ERROR);
+  e1->decrRef();
+  istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4500 4700 3200 3400");
+  e1=new EdgeLin(stream2);
+  bound=e1->getBounds();
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,bound[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,bound[1],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,bound[2],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.47,bound[3],ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //Testing bounds calculation For Arc of circle.
+  
+}
+
+void QuadraticPlanarInterpTest::ReadWriteInXfigGlobal()
+{
+  string dataBaseDir(getenv("MED_ROOT_DIR"));
+  dataBaseDir+="/share/salome/resources/med/";
+  string tmp;
+  tmp=dataBaseDir; tmp+="Pol1.fig";
+  QuadraticPolygon pol1(tmp.c_str());
+  pol1.dumpInXfigFile("Pol1_gen.fig");
+  tmp=dataBaseDir; tmp+="Pol2.fig";
+  QuadraticPolygon pol2(tmp.c_str());
+  pol2.dumpInXfigFile("Pol2_gen.fig");
+  tmp=dataBaseDir; tmp+="Pol3.fig";
+  QuadraticPolygon pol3(tmp.c_str());
+  pol3.dumpInXfigFile("Pol3_gen.fig");
+  tmp=dataBaseDir; tmp+="Pol4.fig";
+  QuadraticPolygon pol4(tmp.c_str());
+  CPPUNIT_ASSERT_EQUAL(1,pol4.size());
+  ElementaryEdge *edge1=dynamic_cast<ElementaryEdge *>(pol4[0]);
+  CPPUNIT_ASSERT(edge1);
+  Edge *edge2=edge1->getPtr();
+  EdgeArcCircle *edge=dynamic_cast<EdgeArcCircle *>(edge2);
+  CPPUNIT_ASSERT(edge);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR);
+  double center[2];
+  edge->getCenter(center);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,center[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48375,center[1],ADMISSIBLE_ERROR);
+  const double *start=*edge->getStartNode();
+  Node *n1=new Node(start[0]+2*(center[0]-start[0]),start[1]+2*(center[1]-start[1]));
+  edge->changeMiddle(n1);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(5.7857653289925404,edge->getAngle(),ADMISSIBLE_ERROR);
+  n1->decrRef();
+  n1=new Node(center[0],center[1]+0.24375);
+  edge->changeMiddle(n1);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.24375,edge->getRadius(),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.49741997818704586,edge->getAngle(),ADMISSIBLE_ERROR);//5.7857653289925404 + 2*PI
+  n1->decrRef();
+  //A half circle.
+  EdgeArcCircle *e=new EdgeArcCircle(0.84,0.54,0.78,0.6,0.84,0.66);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.1415925921507317,e->getAngle(),1e-5);
+  e->decrRef();
+  e=new EdgeArcCircle(0.84,0.54,0.9,0.6,0.84,0.66);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.06,e->getRadius(),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415925921507317,e->getAngle(),1e-5);
+  e->decrRef();
+}
+
+void QuadraticPlanarInterpTest::BasicGeometricTools()
+{
+  Node *n1=new Node(1.,1.);
+  Node *n2=new Node(4.,2.);
+  EdgeLin *e1=new EdgeLin(n1,n2);
+  double tmp[2];
+  e1->getNormalVector(tmp);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.94868329805051377,tmp[1],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.31622776601683794,tmp[0],ADMISSIBLE_ERROR);
+  e1->decrRef();
+  n1->decrRef(); n2->decrRef();
+  n1=new Node(1.,1.);
+  n2=new Node(0.,4.);
+  e1=new EdgeLin(n1,n2);
+  double tmp2[2];
+  e1->getNormalVector(tmp2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,Node::dot(tmp,tmp2),1e-10);
+  tmp[0]=0.5; tmp[1]=2.5;
+  CPPUNIT_ASSERT(e1->isNodeLyingOn(tmp));
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,e1->getDistanceToPoint(tmp),1e-12);
+  tmp[1]=2.55; CPPUNIT_ASSERT(!e1->isNodeLyingOn(tmp));
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0158113883008418,e1->getDistanceToPoint(tmp),1e-12);
+  tmp[0]=0.; tmp[1]=5.;
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,e1->getDistanceToPoint(tmp),1e-12);
+  EdgeArcCircle *e=new EdgeArcCircle(4.,3.,0.,5.,-5.,0.);
+  tmp[0]=-4.; tmp[1]=3.;
+  CPPUNIT_ASSERT(e->isNodeLyingOn(tmp));
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,e->getDistanceToPoint(tmp),1e-12);
+  tmp[1]=3.1; CPPUNIT_ASSERT(!e->isNodeLyingOn(tmp));
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(6.0632371551998077e-2,e->getDistanceToPoint(tmp),1e-12);
+  tmp[0]=-4.; tmp[1]=-3.;
+  CPPUNIT_ASSERT(!e->isNodeLyingOn(tmp));
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1622776601683795,e->getDistanceToPoint(tmp),1e-12);
+  e->decrRef();
+  e1->decrRef();
+  n1->decrRef(); n2->decrRef();
+}
+
+void QuadraticPlanarInterpTest::IntersectionBasics()
+{
+  //Testing intersection of Bounds.
+  istringstream stream1("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800");
+  EdgeLin *e1=new EdgeLin(stream1);
+  istringstream stream2("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3200 3400 4500 4800");
+  EdgeLin *e2=new EdgeLin(stream2);
+  Bounds *bound=e1->getBounds().amIIntersectingWith(e2->getBounds()); CPPUNIT_ASSERT(bound);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.32,(*bound)[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.45,(*bound)[1],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.34,(*bound)[2],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[3],ADMISSIBLE_ERROR);
+  delete bound;
+  e2->decrRef(); e1->decrRef();
+  //
+  istringstream stream3("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n3000 7200 6000 3700");
+  EdgeLin *e3=new EdgeLin(stream3);
+  istringstream stream4("2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2\n4800 6600 7200 4200");
+  EdgeLin *e4=new EdgeLin(stream4);
+  bound=e3->getBounds().amIIntersectingWith(e4->getBounds()); CPPUNIT_ASSERT(bound);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.48,(*bound)[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.6,(*bound)[1],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.42,(*bound)[2],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.66,(*bound)[3],ADMISSIBLE_ERROR);
+  delete bound;
+  e3->decrRef(); e4->decrRef();
+}
+
+void QuadraticPlanarInterpTest::EdgeLinUnitary()
+{
+  EdgeLin *e1=new EdgeLin(0.5,0.5,3.7,4.1);
+  Node *n=new Node(2.1,2.3);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.5,1e-8);
+  n->decrRef();
+  n=new Node(3.7,4.1);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),1.,1e-8);
+  n->decrRef();
+  n=new Node(0.5,0.5);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),0.,1e-8);
+  n->decrRef();
+  n=new Node(-1.1,-1.3);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),-0.5,1e-8);
+  n->decrRef();
+  n=new Node(5.3,5.9);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCharactValue(*n),1.5,1e-8);
+  n->decrRef(); e1->decrRef();
+}
+
+/*!
+ * Here two things are tested. 
+ * 1 ) One the overlapping calculation capability of edge/edge intersector.
+ * 2 ) Then the capability to handle the case where 2 segs (whatever their type) are overlapped.
+ * All the configuration of full or part overlapping have been tested.
+ */
+void QuadraticPlanarInterpTest::IntersectionEdgeOverlapUnitarySegSeg()
+{
+  ComposedEdge& v1=*(new ComposedEdge);
+  ComposedEdge& v2=*(new ComposedEdge);
+  MergePoints v3;
+  //Testing merge of geometric equals seg2.
+  EdgeLin *e1=new EdgeLin(0.5,0.5,1.,1.); EdgeLin *e2=new EdgeLin(0.5,0.5,1.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
+  v1.clear(); v2.clear(); v3.clear();
+  //  - testing by adding some noise
+  e1->decrRef(); e1=new EdgeLin(0.5+5.e-15,0.5-5.e-15,1.,1.+7.e-15);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Testing merge of geometric equals seg2 but now with opposite direction
+  e1=new EdgeLin(0.5,0.5,0.7,0.7); e2=new EdgeLin(0.7+6.e-15,0.7-2.e-15,0.5+3.e-15,0.5-4.e-15);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection());//compared 8 lines above !v2[0]->getDirection()
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 0
+  //Test 1 - OUT_AFTER - OUT_AFTER | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.5,0.,2.,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 2 - INSIDE - OUT_AFTER | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.5,0.,1.5,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 2 - INSIDE - OUT_AFTER | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.5,0.,1.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 2 - INSIDE - OUT_AFTER | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,1.5,1.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresicEqualDirSensitive(v2[0]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 2 - INSIDE - OUT_AFTER | opp. dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.5,1.5,0.5,0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(!v1[1]->intresicEqualDirSensitive(v2[1]) && v1[1]->intresicEqual(v2[1]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode()); CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 3 - INSIDE - INSIDE | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.25,0.,0.75,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
+  CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 3 - INSIDE - INSIDE | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.25,0.,0.75);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
+  CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 3 - INSIDE - INSIDE | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.25,0.25,0.75,0.75);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
+  CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 3 - INSIDE - INSIDE | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.75,0.75,0.25,0.25);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && !v1[1]->getDirection());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==v1[2]->getStartNode());
+  CPPUNIT_ASSERT(v1[0]->getStartNode()== e1->getStartNode()); CPPUNIT_ASSERT(v1[2]->getEndNode()== e1->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(v1[1]->getEndNode()==e2->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 4 - OUT_BEFORE - OUT_BEFORE | same dir. - 0 °
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-1.,0.,-0.5,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 5 - OUT_BEFORE - INSIDE | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,0.5,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 5 - OUT_BEFORE - INSIDE | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0,-0.5,0.,0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 5 - OUT_BEFORE - INSIDE | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,0.5,0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresicEqualDirSensitive(v2[1]));
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 5 - OUT_BEFORE - INSIDE | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,-0.5,-0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(!v1[0]->intresicEqualDirSensitive(v2[0]) && v1[0]->intresicEqual(v2[0]) );
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,1.5,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
+  CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,-0.5,0.,1.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
+  CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 6 - OUT_BEFORE - OUT_AFTER | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,1.5,1.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
+  CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 6 - OUT_BEFORE - OUT_AFTER | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.5,1.5,-0.5,-0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(3,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
+  CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && !v2[1]->getDirection());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode() && v2[1]->getEndNode()==v2[2]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 7 - END - OUT_AFTER | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,0.,1.5,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 7 - END - OUT_AFTER | opp dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.5,0.,1.,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
+  CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 8 - START - END | same dir. - 0°
+  e1=new EdgeLin(0.,0.,0.7,0.); e2=new EdgeLin(0.,0.,0.7,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 8 - START - END | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,0.7); e2=new EdgeLin(0.,0.,0.,0.7);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 8 - START - END | same dir. - 45°
+  e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.,0.,0.7,0.7);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 8 - START - END | opp. dir. - 45°
+  e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.7,0.7,0.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection());
+  CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 9 - OUT_BEFORE - START | same dir.
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,0.,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v2.size());
+  CPPUNIT_ASSERT(e2->getEndNode()==e1->getStartNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 10 - START - OUT_AFTER | same dir. - 0°
+  e1=new EdgeLin(0.,0.,0.7,0.); e2=new EdgeLin(0.,0.,1.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 10 - START - OUT_AFTER | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,0.7); e2=new EdgeLin(0.,0.,0.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 10 - START - OUT_AFTER | same dir. - 45°
+  e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(0.,0.,1.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 10 - START - OUT_AFTER | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,0.7,0.7); e2=new EdgeLin(1.,1.,0.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && !v2[1]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(v2[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 11 - INSIDE - END | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.7,0.,1.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 11 - INSIDE - END | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.7,0.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 11 - INSIDE - END | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.7,0.7,1.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 11 - INSIDE - END | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,1.,0.7,0.7);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode());
+  CPPUNIT_ASSERT(v1[1]->intresincEqCoarse(e2) && !v1[1]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection()); 
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 12 - OUT_BEFORE - END | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(-0.5,0.,1.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 12 - OUT_BEFORE - END | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,-0.5,0.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 12 - OUT_BEFORE - END | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(-0.5,-0.5,1.,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[1]->intresincEqCoarse(e1) && v2[1]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 12 - OUT_BEFORE - END | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,1.,-0.5,-0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e1) && !v2[0]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2[0]->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==e2->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==v2[1]->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 13 - START - INSIDE | same dir. - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.,0.,0.5,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 13 - START - INSIDE | same dir. - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.,0.,0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 13 - START - INSIDE | same dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.,0.,0.5,0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e2->getStartNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 13 - START - INSIDE | opp dir. - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.5,0.5,0.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e2) && !v1[0]->getDirection()); CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(e2->getEndNode()==v1[0]->getStartNode()); CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e1->getEndNode()==v1[1]->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  ComposedEdge::Delete(&v1);
+  ComposedEdge::Delete(&v2);
+}
+
+/*!
+ * Here there is test of cases where between 2 edges intersects only in points not on edge.
+ */
+void QuadraticPlanarInterpTest::IntersectionPointOnlyUnitarySegSeg()
+{
+  // 0° - classical
+  EdgeLin *e1=new EdgeLin(0.,0.,1.,0.);
+  EdgeLin *e2=new EdgeLin(0.3,0.3,0.5,-0.3);
+  ComposedEdge& v1=*(new ComposedEdge);
+  ComposedEdge& v2=*(new ComposedEdge); MergePoints v3;
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,(*v1[0]->getEndNode())[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR);
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  // 90° - classical
+  e1=new EdgeLin(0.,0.,0.,1.);
+  e2=new EdgeLin(-0.3,0.3,0.3,0.5);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT(v1[0]->getEndNode()==v1[1]->getStartNode()); CPPUNIT_ASSERT(v2[0]->getEndNode()==v2[1]->getStartNode());
+  CPPUNIT_ASSERT(e1->getStartNode()==v1.front()->getStartNode() && e1->getEndNode()==v1.back()->getEndNode());
+  CPPUNIT_ASSERT(e2->getStartNode()==v2.front()->getStartNode() && e2->getEndNode()==v2.back()->getEndNode());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,(*v1[0]->getEndNode())[0],ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.4,(*v1[0]->getEndNode())[1],ADMISSIBLE_ERROR);
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 1 - 0°
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(0.,0.,0.,1.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 1 - 90°
+  e1=new EdgeLin(0.,0.,0.,1.); e2=new EdgeLin(0.,0.,1.,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 1 - 45°
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(0.,0.,1.,-1.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 2
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,1.,1.,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v3.isEnd1(0)); CPPUNIT_ASSERT(v3.isEnd2(0));
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 3
+  e1=new EdgeLin(0.,0.,1.,0.); e2=new EdgeLin(1.,0.,1.,1.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v3.isEnd1(0)); CPPUNIT_ASSERT(v3.isStart2(0));
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Test 4
+  e1=new EdgeLin(0.,0.,1.,1.); e2=new EdgeLin(1.,-1.,0.,0.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v3.isStart1(0)); CPPUNIT_ASSERT(v3.isEnd2(0));
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Intersection extremity of one edge and inside of other edge. 2 End.
+  e1=new EdgeLin(0.,0.,1.,0.);
+  e2=new EdgeLin(0.5,1.,0.5,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode() && v1[0]->getEndNode()==e2->getEndNode() && v1[1]->getStartNode()==e2->getEndNode() && v1[1]->getEndNode()==e1->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getDirection() && v1[1]->getDirection());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Intersection extremity of one edge and inside of other edge. 2 Start.
+  e1=new EdgeLin(0.,0.,1.,0.);
+  e2=new EdgeLin(0.5,0.,0.5,1.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(2,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(1,(int)v2.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v2[0]->intresincEqCoarse(e2) && v2[0]->getDirection());
+  CPPUNIT_ASSERT(v1[0]->getStartNode()==e1->getStartNode() && v1[0]->getEndNode()==e2->getStartNode() && v1[1]->getStartNode()==e2->getStartNode() && v1[1]->getEndNode()==e1->getEndNode());
+  CPPUNIT_ASSERT(v1[0]->getDirection() && v1[1]->getDirection());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Intersection extremity of one edge and inside of other edge. 1 Start.
+  e1=new EdgeLin(0.5,0.,0.5,1.);
+  e2=new EdgeLin(0.,0.,1.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
+  CPPUNIT_ASSERT(v2[0]->getStartNode()==e2->getStartNode() && v2[0]->getEndNode()==e1->getStartNode() && v2[1]->getStartNode()==e1->getStartNode() && v2[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getDirection() && v2[1]->getDirection());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  //Intersection extremity of one edge and inside of other edge. 1 End.
+  e1=new EdgeLin(0.5,1.,0.5,0.);
+  e2=new EdgeLin(0.,0.,1.,0.);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,v3,v1,v2));
+  CPPUNIT_ASSERT_EQUAL(1,(int)v1.size());
+  CPPUNIT_ASSERT_EQUAL(2,(int)v2.size());
+  CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT(v1[0]->intresincEqCoarse(e1) && v1[0]->getDirection());
+  CPPUNIT_ASSERT(v2[0]->getStartNode()==e2->getStartNode() && v2[0]->getEndNode()==e1->getEndNode() && v2[1]->getStartNode()==e1->getEndNode() && v2[1]->getEndNode()==e2->getEndNode());
+  CPPUNIT_ASSERT(v2[0]->getDirection() && v2[1]->getDirection());
+  e2->decrRef(); e1->decrRef();
+  v1.clear(); v2.clear(); v3.clear();
+  ComposedEdge::Delete(&v2);
+  ComposedEdge::Delete(&v1);
+}
diff --git a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest.hxx b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest.hxx
new file mode 100644 (file)
index 0000000..2c13873
--- /dev/null
@@ -0,0 +1,93 @@
+#ifndef _QUADRATICPLANARINTERPTEST_HXX_
+#define _QUADRATICPLANARINTERPTEST_HXX_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace INTERP_KERNEL
+{
+  class Node;
+  class EdgeArcCircle;
+  class QuadraticPolygon;
+
+  class QuadraticPlanarInterpTest : public CppUnit::TestFixture
+  {
+    CPPUNIT_TEST_SUITE( QuadraticPlanarInterpTest );
+    CPPUNIT_TEST( ReadWriteInXfigElementary );
+    CPPUNIT_TEST( ReadWriteInXfigGlobal );
+    CPPUNIT_TEST( BasicGeometricTools );
+    CPPUNIT_TEST( IntersectionBasics );
+    CPPUNIT_TEST( EdgeLinUnitary );
+    CPPUNIT_TEST( IntersectionEdgeOverlapUnitarySegSeg );
+    CPPUNIT_TEST( IntersectionPointOnlyUnitarySegSeg );
+    CPPUNIT_TEST( IntersectArcCircleBase );
+    CPPUNIT_TEST( IntersectArcCircleFull );
+    CPPUNIT_TEST( IntersectArcCircleSegumentBase );
+    CPPUNIT_TEST( checkInOutDetection );
+    CPPUNIT_TEST( checkAssemblingBases1 );
+    CPPUNIT_TEST( checkAssemblingBases2 );
+    CPPUNIT_TEST( checkPolygonsIntersection1 );
+    CPPUNIT_TEST( checkAreasCalculations );
+    CPPUNIT_TEST( checkHighLevelFunctionTest1 );
+    CPPUNIT_TEST( check1DInterpLin );
+    CPPUNIT_TEST( checkNonRegression1 );
+    CPPUNIT_TEST( checkNonRegression2 );
+    CPPUNIT_TEST( checkNonRegression3 );
+    CPPUNIT_TEST( checkNonRegression4 );
+//     CPPUNIT_TEST( checkNonRegression5 );
+    CPPUNIT_TEST( checkNonRegression6 );
+    CPPUNIT_TEST( checkNonRegression7 );
+    CPPUNIT_TEST( checkNonRegression8 );
+    CPPUNIT_TEST( checkNonRegression9 );
+    CPPUNIT_TEST( checkNonRegression10 );
+    CPPUNIT_TEST( checkNonRegression11 );
+//     CPPUNIT_TEST( checkNonRegression12 );
+    CPPUNIT_TEST_SUITE_END();
+  public:  
+    void setUp();
+    void tearDown();
+    void cleanUp();
+    //
+    void ReadWriteInXfigElementary();
+    void ReadWriteInXfigGlobal();
+    void BasicGeometricTools();
+    void IntersectionBasics();
+    void EdgeLinUnitary();
+    void IntersectionEdgeOverlapUnitarySegSeg();
+    void IntersectionPointOnlyUnitarySegSeg();
+    //
+    void IntersectArcCircleBase();
+    void IntersectArcCircleFull();
+    void IntersectArcCircleSegumentBase();
+    //
+    void checkInOutDetection();
+    //
+    void checkAssemblingBases1();
+    void checkAssemblingBases2();
+    //
+    void checkPolygonsIntersection1();
+    void checkAreasCalculations();
+    //
+    void checkHighLevelFunctionTest1();
+    //
+    void check1DInterpLin();
+    //
+    void checkNonRegression1();
+    void checkNonRegression2();
+    void checkNonRegression3();
+    void checkNonRegression4();
+    void checkNonRegression5();
+    void checkNonRegression6();
+    void checkNonRegression7();
+    void checkNonRegression8();
+    void checkNonRegression9();
+    void checkNonRegression10();
+    void checkNonRegression11();
+    void checkNonRegression12();
+  private:
+    EdgeArcCircle *buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd);
+    double btw2NodesAndACenter(const Node& n1, const Node& n2, const double *center);
+    void checkBasicsOfPolygons(QuadraticPolygon& pol1, QuadraticPolygon& pol2, bool checkDirection);
+  };
+}
+
+#endif
diff --git a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest2.cxx b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest2.cxx
new file mode 100644 (file)
index 0000000..7cb4b35
--- /dev/null
@@ -0,0 +1,643 @@
+#include "QuadraticPlanarInterpTest.hxx"
+#include "QuadraticPolygon.hxx"
+#include "EdgeArcCircle.hxx"
+#include "EdgeLin.hxx"
+
+#include <cmath>
+#include <sstream>
+#include <iostream>
+
+using namespace std;
+using namespace INTERP_KERNEL;
+
+static const double ADMISSIBLE_ERROR = 1.e-14;
+
+void QuadraticPlanarInterpTest::IntersectArcCircleBase()
+{
+  double center[2]={0.5,0.5};
+  double radius=0.3;
+  EdgeArcCircle *e1=buildArcOfCircle(center,radius,M_PI/4.,M_PI/3.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/3),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,M_PI/3.,M_PI/2.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/2),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(M_PI/3),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/2),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,M_PI/3.,3.*M_PI/4.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(3*M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(M_PI/3),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(3*M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/2),ADMISSIBLE_ERROR);//<<
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,3*M_PI/4,7*M_PI/8);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(7*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(3*M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(7*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(3*M_PI/4),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,7.*M_PI/8.,9.*M_PI/8.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI),ADMISSIBLE_ERROR);//<<
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(7*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(9*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(7*M_PI/8),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,9.*M_PI/8.,11.*M_PI/8.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(9*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(11*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(11*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(9*M_PI/8),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,11.*M_PI/8.,7.*M_PI/4.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(11*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(7*M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(3*M_PI/2),ADMISSIBLE_ERROR);//<<
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(7*M_PI/4),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+   e1=buildArcOfCircle(center,radius,7.*M_PI/4.,15.*M_PI/8.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(7*M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(15*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(7*M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(15*M_PI/8),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  e1=buildArcOfCircle(center,radius,-M_PI/8.,M_PI/4.);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[0],center[0]+radius*cos(M_PI/4),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[1],center[0]+radius*cos(0.),ADMISSIBLE_ERROR);      //<<
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[2],center[1]+radius*sin(15*M_PI/8),ADMISSIBLE_ERROR);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getBounds()[3],center[1]+radius*sin(M_PI/4),ADMISSIBLE_ERROR);
+  e1->decrRef();
+  //
+  // ArcCArcCIntersector
+  //
+  TypeOfLocInEdge where1,where2;
+  vector<Node *> v4;
+  MergePoints v3;
+  EdgeArcCircle *e2;
+  ArcCArcCIntersector *intersector=0;
+  for(unsigned k=0;k<8;k++)
+    {
+      e1=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,M_PI/3.+k*M_PI/4.);
+      e2=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,M_PI/3.+k*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3);
+      CPPUNIT_ASSERT(where1==START && where2==END);
+      delete intersector; v3.clear(); e2->decrRef();
+      //
+      e2=buildArcOfCircle(center,radius,7*M_PI/24.+k*M_PI/4.,M_PI/3.+k*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3);
+      CPPUNIT_ASSERT(where1==INSIDE && where2==END);
+      delete intersector; v3.clear(); e2->decrRef();
+      //
+      e2=buildArcOfCircle(center,radius,M_PI/4.+k*M_PI/4.,7*M_PI/24.+k*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3);
+      CPPUNIT_ASSERT(where1==START && where2==INSIDE);
+      delete intersector; v3.clear(); e2->decrRef();
+      //
+      e2=buildArcOfCircle(center,radius,13.*M_PI/48.+k*M_PI/4.,15*M_PI/48.+k*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3);
+      CPPUNIT_ASSERT(where1==INSIDE && where2==INSIDE);
+      delete intersector; v3.clear(); e2->decrRef();
+      //
+      e2=buildArcOfCircle(center,radius,-M_PI/4.+k*M_PI/4.,M_PI/6.+k*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3);
+      CPPUNIT_ASSERT(where1==OUT_BEFORE && where2==OUT_BEFORE);
+      delete intersector; v3.clear(); e2->decrRef();
+      //
+      e2=buildArcOfCircle(center,radius,0+k*M_PI/4.,5*M_PI/6.+k*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      intersector->getPlacements(e2->getStartNode(),e2->getEndNode(),where1,where2,v3);
+      CPPUNIT_ASSERT(where1==OUT_BEFORE && where2==OUT_AFTER);
+      delete intersector; v3.clear(); e2->decrRef();
+      e1->decrRef();
+    }
+  // Ok now let's see intersection only. 2 intersections R1 > R2 ; dist(circle1,circle2)>R1; Opposite order.
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,1.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Ok now let's see intersection only. 2 intersections R1 > R2 ; dist(circle1,circle2)>R1; Same order.
+  for(unsigned k=0;k<7;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,1.,M_PI+(k+1)*M_PI/4.,M_PI+(k-1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.35587863972199624,1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // 2 intersections R1>R2 ; dist(circle1,circle2)<R1; Same order.
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=2.8*cos(k*M_PI/4.); center2[1]=2.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,1.,(k)*M_PI/4.-M_PI/2.,(k)*M_PI/4.+M_PI/2.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // 2 intersections R1>R2 ; dist(circle1,circle2)<R1; Opp order.
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=2.8*cos(k*M_PI/4.); center2[1]=2.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,1.,(k)*M_PI/4.+M_PI/2.,(k)*M_PI/4.-M_PI/2.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),0.6793851523346941,1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+       (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)>R2; Opposite order.
+  for(unsigned k=0;k<1;k++)
+    {
+      double center2[2]; center[0]=0.; center[1]=0.;
+      center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,1.,(k-1)*M_PI/4.,(k+1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,3.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)>R2; same order.
+  for(unsigned k=0;k<8;k++)
+    {
+      double center2[2]; center[0]=0.; center[1]=0.;
+      center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,1.,(k+1)*M_PI/4.,(k-1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,3.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.1195732971845034,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)<R2; same order.
+  for(unsigned k=0;k<8;k++)
+    {
+      double center2[2]; center[0]=0.; center[1]=0.;
+      center2[0]=-2.8*cos(k*M_PI/4.); center2[1]=-2.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,1.,(k)*M_PI/4.+M_PI/2.,(k)*M_PI/4.-M_PI/2.);
+      e2=buildArcOfCircle(center2,3.,(k+1)*M_PI/4.,(k-1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Ok now let's see intersection only. 2 intersections R1 < R2 ; dist(circle1,circle2)<R2; opp. order.
+  for(unsigned k=0;k<8;k++)
+    {
+      double center2[2]; center[0]=0.; center[1]=0.;
+      center2[0]=-2.8*cos(k*M_PI/4.); center2[1]=-2.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,1.,(k)*M_PI/4.+M_PI/2.,(k)*M_PI/4.-M_PI/2.);
+      e2=buildArcOfCircle(center2,3.,(k-1)*M_PI/4.,(k+1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order);
+      CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[1]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT(!v4[0]->isEqual(*v4[1]));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(-3.0844420190512074,btw2NodesAndACenter(*v4[0],*v4[1],e1->getCenter()),1e-10);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Tangent intersection
+  QUADRATIC_PLANAR::setPrecision(1e-5);
+  for(unsigned k=0;k<8;k++)
+    {
+      double center2[2]; center[0]=0.; center[1]=0.;
+      center2[0]=4.*cos(k*M_PI/4.); center2[1]=4.*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,1.,(k+1)*M_PI/4.,(k-1)*M_PI/4.);
+      e2=buildArcOfCircle(center2,3.,M_PI+(k-1)*M_PI/4.,M_PI+(k+1)*M_PI/4.);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); // order has no sence here because v4.size() expected to 1 but for valgrind serenity test.
+      CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getRadius(),Node::distanceBtw2Pt(e1->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(e2->getRadius(),Node::distanceBtw2Pt(e2->getCenter(),(*(v4[0]))),ADMISSIBLE_ERROR);
+      for(vector<Node *>::iterator iter=v4.begin();iter!=v4.end();iter++)
+        (*iter)->decrRef();
+      v4.clear(); v4.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  QUADRATIC_PLANAR::setPrecision(1e-14);
+  // Extremities # 1
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812);
+      e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.-0.55978664859225125,M_PI+k*M_PI/4.+0.55978664859225125);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(!intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT_EQUAL(0,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT(e1->getStartNode()==e2->getEndNode()); CPPUNIT_ASSERT(e2->getStartNode()==e1->getEndNode());
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812);
+      e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.55978664859225125,M_PI+k*M_PI/4.-0.55978664859225125);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(!intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT_EQUAL(0,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(2,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e2->getEndNode()==e1->getEndNode());
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Extremities # 2
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812);
+      e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.55978664859225125,M_PI+k*M_PI/4.-0.7);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3));
+      CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(1,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT(e1->getStartNode()==e2->getStartNode()); CPPUNIT_ASSERT(e1->getEndNode()==v4[0]);
+      v4[0]->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+      }
+  // Extremities # 3
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      e1=buildArcOfCircle(center,3.,k*M_PI/4.-0.17793931986099812,k*M_PI/4.+0.17793931986099812);
+      e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.7,M_PI+k*M_PI/4.-0.7);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT(e1->getStartNode()==v4[0]); CPPUNIT_ASSERT(e1->getEndNode()==v4[1]);
+      v4[0]->decrRef(); v4[1]->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  // Extremities # 4
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      Node *nodeS=new Node(center[0]+3.*cos(k*M_PI/4.-0.17793931986099812),center[1]+3.*sin(k*M_PI/4.-0.17793931986099812));
+      Node *nodeE=new Node(center[0]+3.*cos(k*M_PI/4.),center[1]+3.*sin(k*M_PI/4.));
+      double angle=k*M_PI/4.-0.17793931986099812;
+      angle=angle>M_PI?angle-2.*M_PI:angle;
+      e1=new EdgeArcCircle(nodeS,nodeE,//Problem of precision 1e-14 to easily reached.
+                          center,3.,angle,0.17793931986099812);
+      nodeS->decrRef(); nodeE->decrRef();
+      e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.7,M_PI+k*M_PI/4.-0.7);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT(e1->getStartNode()==v4[0]);
+      v4[0]->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+  //Extremities # 5
+  for(unsigned k=0;k<8;k++)
+    {
+      center[0]=0.; center[1]=0.;
+      double center2[2]; center2[0]=3.8*cos(k*M_PI/4.); center2[1]=3.8*sin(k*M_PI/4.);
+      Node *nodeS=new Node(center[0]+3.*cos(k*M_PI/4.-0.17793931986099812),center[1]+3.*sin(k*M_PI/4.-0.17793931986099812));
+      Node *nodeE=new Node(center[0]+3.*cos(k*M_PI/4.)+0.5,center[1]+3.*sin(k*M_PI/4.));
+      double angle=k*M_PI/4.-0.17793931986099812;
+      angle=angle>M_PI?angle-2.*M_PI:angle;
+      e1=new EdgeArcCircle(nodeS,nodeE,//Problem of precision 1e-14 to easily reached.
+                          center,3.,angle,0.67793931986099812);
+      nodeS->decrRef(); nodeE->decrRef();
+      e2=buildArcOfCircle(center2,1.,M_PI+k*M_PI/4.+0.7,M_PI+k*M_PI/4.-0.7);
+      intersector=new ArcCArcCIntersector(*e1,*e2);
+      bool order;
+      bool obvious,areOverlapped;
+      intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+      CPPUNIT_ASSERT(!obvious && !areOverlapped);
+      CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+      CPPUNIT_ASSERT(e1->getStartNode()==v4[0]);
+      v4[0]->decrRef(); v4[1]->decrRef();
+      v4.clear(); v3.clear();
+      delete intersector; e2->decrRef(); e1->decrRef();
+    }
+}
+
+void QuadraticPlanarInterpTest::IntersectArcCircleFull()
+{
+  double center1[2]; center1[0]=0.;   center1[1]=0.;   double radius1=3.;
+  double center2[2]; center2[0]=0.75; center2[1]=-2.6; double radius2=1.;
+  EdgeArcCircle *e1=buildArcOfCircle(center1,radius1,-M_PI/3.,4.*M_PI/3.);
+  EdgeArcCircle *e2=buildArcOfCircle(center2,radius2,0.,M_PI/2.);
+  MergePoints commonNode;
+  QuadraticPolygon pol1; QuadraticPolygon pol2;
+  QuadraticPolygon pol3; QuadraticPolygon pol4;
+  pol3.pushBack(e1); pol4.pushBack(e2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol3.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol4.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(19.6648305849,pol3.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol4.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol1,pol2));
+  CPPUNIT_ASSERT_EQUAL(2,pol1.size());
+  CPPUNIT_ASSERT_EQUAL(2,pol2.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(19.6648305849,pol1.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol2.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol1.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol2.getPerimeterFast(),1e-6);
+  //
+  e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.);
+  e2=buildArcOfCircle(center2,radius2,0.,M_PI/2.);
+  commonNode.clear();
+  QuadraticPolygon pol5; QuadraticPolygon pol6;
+  QuadraticPolygon pol7; QuadraticPolygon pol8;
+  pol7.pushBack(e1); pol8.pushBack(e2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol7.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol8.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol7.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol8.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol5,pol6));
+  CPPUNIT_ASSERT_EQUAL(2,pol5.size());
+  CPPUNIT_ASSERT_EQUAL(2,pol6.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol5.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.8146018366,pol6.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol5.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol6.getPerimeterFast(),1e-6);
+  //
+  center2[0]=3.5; center2[1]=0.;
+  e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.);
+  e2=buildArcOfCircle(center2,radius2,M_PI/2.,3*M_PI/2.);
+  commonNode.clear();
+  QuadraticPolygon pol9; QuadraticPolygon pol10;
+  QuadraticPolygon pol11; QuadraticPolygon pol12;
+  pol11.pushBack(e1); pol12.pushBack(e2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol11.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol12.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol11.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol12.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol9,pol10));
+  CPPUNIT_ASSERT_EQUAL(3,pol9.size());
+  CPPUNIT_ASSERT_EQUAL(3,pol10.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol9.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol10.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol9.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5707963267949,pol10.getAreaFast(),1e-6);
+  //
+  center2[0]=0.; center2[1]=0.; radius2=radius1;
+  e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.);
+  e2=buildArcOfCircle(center2,radius2,M_PI/3.,2*M_PI/3.);
+  commonNode.clear();
+  QuadraticPolygon pol13; QuadraticPolygon pol14;
+  QuadraticPolygon pol15; QuadraticPolygon pol16;
+  pol15.pushBack(e1); pol16.pushBack(e2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol15.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol16.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol15.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(8.6095032974147,pol16.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol13,pol14));
+  CPPUNIT_ASSERT_EQUAL(3,pol13.size());
+  CPPUNIT_ASSERT_EQUAL(1,pol14.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol13.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol13.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol14.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(8.6095032974147,pol14.getAreaFast(),1e-6);
+  //
+  e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.);
+  e2=buildArcOfCircle(center2,radius2,2*M_PI/3.,M_PI/3.);
+  commonNode.clear();
+  QuadraticPolygon pol17; QuadraticPolygon pol18;
+  QuadraticPolygon pol19; QuadraticPolygon pol20;
+  pol19.pushBack(e1); pol20.pushBack(e2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol19.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol20.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol19.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.6095032974147,pol20.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT(e1->intersectWith(e2,commonNode,pol17,pol18));
+  CPPUNIT_ASSERT_EQUAL(3,pol17.size());
+  CPPUNIT_ASSERT_EQUAL(1,pol18.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(15.707963267948966,pol17.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-19.6648305849,pol17.getAreaFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.1415926535897931,pol18.getPerimeterFast(),1e-6);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.6095032974147,pol18.getAreaFast(),1e-6);
+  //no intersection #1
+  center2[0]=4.277; center2[1]=-4.277;
+  e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.);
+  e2=buildArcOfCircle(center2,radius2,M_PI/4.,5*M_PI/4.);
+  QuadraticPolygon polTemp1; QuadraticPolygon polTemp2;
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,commonNode,polTemp1,polTemp2));
+  e1->decrRef(); e2->decrRef();
+  //no intersection #2
+  center2[0]=1.; center2[1]=-1.; radius2=0.2;
+  e1=buildArcOfCircle(center1,radius1,-2*M_PI/3.,-7.*M_PI/3.);
+  e2=buildArcOfCircle(center2,radius2,M_PI/4.,5*M_PI/4.);
+  CPPUNIT_ASSERT(!e1->intersectWith(e2,commonNode,polTemp1,polTemp2));
+  e1->decrRef(); e2->decrRef();
+}
+
+void QuadraticPlanarInterpTest::IntersectArcCircleSegumentBase()
+{
+  double center[2]={2.,2.};
+  EdgeArcCircle *e1=buildArcOfCircle(center,2.3,M_PI/4.,5.*M_PI/4.);
+  EdgeLin *e2=new EdgeLin(-1.3,1.,3.,5.3);
+  Intersector *intersector=new ArcCSegIntersector(*e1,*e2);
+  bool order;
+  bool obvious,areOverlapped;
+  intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped);
+  CPPUNIT_ASSERT(!obvious && !areOverlapped);
+  vector<Node *> v4;
+  MergePoints v3;
+  CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(!order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.3,(*v4[1])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[1])[1],1e-10);
+  v4[0]->decrRef(); v4[1]->decrRef(); e2->decrRef(); v3.clear(); v4.clear(); delete intersector;
+  //
+  e2=new EdgeLin(3.,5.3,-1.3,1.);
+  intersector=new ArcCSegIntersector(*e1,*e2);
+  intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(!obvious && !areOverlapped);
+  CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(2,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.3,(*v4[1])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[1])[1],1e-10);
+  v4[0]->decrRef(); v4[1]->decrRef(); e2->decrRef(); v3.clear(); v4.clear(); delete intersector;
+  // tangent intersection
+  e2=new EdgeLin(-1.,4.3,3.,4.3);
+  intersector=new ArcCSegIntersector(*e1,*e2);
+  intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(!obvious && !areOverlapped);
+  CPPUNIT_ASSERT(intersector->intersect(0,v4,order,v3)); CPPUNIT_ASSERT(order); CPPUNIT_ASSERT_EQUAL(1,(int)v4.size()); CPPUNIT_ASSERT_EQUAL(0,(int)v3.getNumberOfAssociations());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,(*v4[0])[0],1e-10); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.3,(*v4[0])[1],1e-10);
+  v4[0]->decrRef(); e2->decrRef(); v3.clear(); delete intersector;
+  // no intersection
+  e2=new EdgeLin(-2.,-2.,-1.,-3.);
+  intersector=new ArcCSegIntersector(*e1,*e2);
+  intersector->areOverlappedOrOnlyColinears(0,obvious,areOverlapped); CPPUNIT_ASSERT(obvious && !areOverlapped);
+  e2->decrRef(); v3.clear(); delete intersector;
+  //
+  e1->decrRef();
+}
+
+EdgeArcCircle *QuadraticPlanarInterpTest::buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd)
+{
+  double alphaM=(alphaStart+alphaEnd)/2;
+  return new EdgeArcCircle(center[0]+cos(alphaStart)*radius,center[1]+sin(alphaStart)*radius,
+                          center[0]+cos(alphaM)*radius,center[1]+sin(alphaM)*radius,
+                          center[0]+cos(alphaEnd)*radius,center[1]+sin(alphaEnd)*radius);
+}
+
+double QuadraticPlanarInterpTest::btw2NodesAndACenter(const Node& n1, const Node& n2, const double *center)
+{
+  const double *n1Pt=n1;
+  const double *n2Pt=n2;
+  double tmp1[2],tmp2[2];
+  tmp1[0]=n1Pt[0]-center[0]; tmp1[1]=n1Pt[1]-center[1];
+  tmp2[0]=n2Pt[0]-center[0]; tmp2[1]=n2Pt[1]-center[1];
+  double distTmp1=sqrt(tmp1[0]*tmp1[0]+tmp1[1]*tmp1[1]);
+  double distTmp2=sqrt(tmp2[0]*tmp2[0]+tmp2[1]*tmp2[1]);
+  double ret=acos((tmp1[0]*tmp2[0]+tmp1[1]*tmp2[1])/(distTmp1*distTmp2));
+  if(tmp1[0]*tmp2[1]-tmp1[1]*tmp2[0]<0)
+    ret=-ret;
+  return ret;
+}
diff --git a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest3.cxx b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest3.cxx
new file mode 100644 (file)
index 0000000..1b3f93b
--- /dev/null
@@ -0,0 +1,300 @@
+#include "QuadraticPlanarInterpTest.hxx"
+#include "QuadraticPolygon.hxx"
+#include "ElementaryEdge.hxx"
+#include "EdgeArcCircle.hxx"
+#include "EdgeLin.hxx"
+
+#include <cmath>
+#include <sstream>
+#include <iostream>
+
+using namespace std;
+using namespace INTERP_KERNEL;
+
+
+void QuadraticPlanarInterpTest::checkInOutDetection()
+{
+  Node *n1=new Node(0.,0.);
+  Node *n2=new Node(1.,0.);
+  Node *n3=new Node(0.5,1.);
+  EdgeLin *e1=new EdgeLin(n1,n2);
+  EdgeLin *e2=new EdgeLin(n2,n3);
+  EdgeLin *e3=new EdgeLin(n3,n1);
+  ComposedEdge *tri=new ComposedEdge;
+  tri->pushBack(e1); tri->pushBack(e2); tri->pushBack(e3);
+  //
+  Node *where=new Node(0.4,0.1);
+  CPPUNIT_ASSERT(tri->isInOrOut(where)); where->decrRef();
+  where=new Node(-0.1,1.);
+  CPPUNIT_ASSERT(!tri->isInOrOut(where)); where->decrRef();
+  where=new Node(0.6,-0.1);
+  CPPUNIT_ASSERT(!tri->isInOrOut(where)); where->decrRef();
+  //Clean-up
+  n1->decrRef(); n2->decrRef(); n3->decrRef();
+  ComposedEdge::Delete(tri);
+}
+
+/*!
+ * Check Iterators mechanism.
+ */
+void QuadraticPlanarInterpTest::checkAssemblingBases1()
+{
+  Node *n1=new Node(0.,0.);
+  Node *n2=new Node(0.1,0.); EdgeLin *e1_2=new EdgeLin(n1,n2);
+  Node *n3=new Node(0.2,0.); EdgeLin *e2_3=new EdgeLin(n2,n3);
+  Node *n4=new Node(0.3,0.); EdgeLin *e3_4=new EdgeLin(n3,n4);
+  Node *n5=new Node(0.4,0.); EdgeLin *e4_5=new EdgeLin(n4,n5);
+  Node *n6=new Node(0.5,0.); EdgeLin *e5_6=new EdgeLin(n5,n6);
+  Node *n7=new Node(0.6,0.); EdgeLin *e6_7=new EdgeLin(n6,n7);
+  Node *n8=new Node(0.7,0.); EdgeLin *e7_8=new EdgeLin(n7,n8);
+  Node *n9=new Node(0.8,0.); EdgeLin *e8_9=new EdgeLin(n8,n9);
+  Node *n10=new Node(0.9,0.); EdgeLin *e9_10=new EdgeLin(n9,n10);
+  Node *n11=new Node(1.,0.); EdgeLin *e10_11=new EdgeLin(n10,n11);
+  Node *n12=new Node(0.5,1.); EdgeLin *e11_12=new EdgeLin(n11,n12);
+  EdgeLin *e12_1=new EdgeLin(n12,n1);
+  //Only one level
+  e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef(); 
+  e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef();
+  ComposedEdge *c=new ComposedEdge;
+  c->pushBack(e1_2); c->pushBack(e2_3); c->pushBack(e3_4); c->pushBack(e4_5); c->pushBack(e5_6); c->pushBack(e6_7);
+  c->pushBack(e7_8); c->pushBack(e8_9); c->pushBack(e9_10); c->pushBack(e10_11); c->pushBack(e11_12); c->pushBack(e12_1);
+  CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize());
+  IteratorOnComposedEdge it(c);
+  CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished());
+  it.next(); CPPUNIT_ASSERT(it.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it.finished());
+  it.next(); it.next(); CPPUNIT_ASSERT(it.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it.finished());
+  it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it.finished());
+  it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it.finished());
+  it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished());
+  it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it.finished());
+  it.next(); CPPUNIT_ASSERT(it.finished());
+  it.first(); CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished());
+  it.previousLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it.finished());
+  it.nextLoop(); CPPUNIT_ASSERT(it.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it.finished());
+  it.last(); CPPUNIT_ASSERT(it.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it.finished());
+  //Multi-Level
+  ComposedEdge::Delete(c);
+  //(e1_2, (e2_3,(e3_4, e4_5, e5_6, e6_7, (e7_8, e8_9 ), ( e9_10 , e10_11 ), e11_12 ),e12_1 ) )
+  e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_7->incrRef(); 
+  e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef();
+  ComposedEdge *c2_2_4=new ComposedEdge; c2_2_4->pushBack(e7_8); c2_2_4->pushBack(e8_9);
+  ComposedEdge *c2_2_5=new ComposedEdge; c2_2_5->pushBack(e9_10); c2_2_5->pushBack(e10_11);
+  ComposedEdge *c2_2=new ComposedEdge; c2_2->pushBack(e3_4); c2_2->pushBack(e4_5); c2_2->pushBack(e5_6);  c2_2->pushBack(e6_7); c2_2->pushBack(c2_2_4); c2_2->pushBack(c2_2_5); c2_2->pushBack(e11_12);
+  ComposedEdge *c2=new ComposedEdge; c2->pushBack(e2_3); c2->pushBack(c2_2); c2->pushBack(e12_1);
+  c=new ComposedEdge; c->pushBack(e1_2); c->pushBack(c2); CPPUNIT_ASSERT_EQUAL(12,c->recursiveSize());
+  IteratorOnComposedEdge it2(c);
+  CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2);
+  it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished());
+  it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished());
+  it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished());
+  it2.next(); CPPUNIT_ASSERT(it2.finished());
+  it2.first(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.last(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished());
+  it2.first(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished());
+  //  substitutions.
+  it2.first(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished());
+  ElementaryEdge *&tmp=it2.current(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_2); CPPUNIT_ASSERT(!it2.finished());
+  ComposedEdge *c1=new ComposedEdge;  Node *n1_bis=new Node(0.,0.05); EdgeLin *e1_1bis=new EdgeLin(n1,n1_bis); EdgeLin *e1bis_2=new EdgeLin(n1_bis,n2); e1_1bis->incrRef(); e1bis_2->incrRef();
+  c1->pushBack(e1_1bis); c1->pushBack(e1bis_2); delete tmp; tmp=(ElementaryEdge *)c1; CPPUNIT_ASSERT_EQUAL(13,c->recursiveSize());
+  CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished());// here testing capability of Iterator.'current' method to deal with change of hierarchy.
+  it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.next(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e11_12); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e10_11); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e9_10); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e8_9); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e7_8); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e6_7); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e5_6); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished());
+  it2.previousLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished());
+  //go forward
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1bis_2); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e2_3); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e3_4); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e4_5); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e5_6); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e6_7); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e7_8); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e8_9); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e9_10); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e10_11); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e11_12); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e12_1); CPPUNIT_ASSERT(!it2.finished());
+  it2.nextLoop(); CPPUNIT_ASSERT(it2.current()->getPtr()==e1_1bis); CPPUNIT_ASSERT(!it2.finished());
+  ComposedEdge::Delete(c);
+  //clean-up
+  e1_1bis->decrRef(); e1bis_2->decrRef();
+  e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_7->decrRef(); 
+  e7_8->decrRef(); e8_9->decrRef(); e9_10->decrRef(); e10_11->decrRef(); e11_12->decrRef(); e12_1->decrRef(); 
+  n1_bis->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+  n7->decrRef(); n8->decrRef(); n9->decrRef(); n10->decrRef(); n11->decrRef(); n12->decrRef();
+}
+
+/*!
+ * Check splitting of 2 polygons. After this operation, all ElementaryEdge are either in/out/on.
+ */
+void QuadraticPlanarInterpTest::checkAssemblingBases2()
+{
+  //The "most" basic test1
+  Node *n1=new Node(0.,0.);                Node *n4=new Node(0.,-0.3);   
+  Node *n2=new Node(1.,0.);                Node *n5=new Node(1.,-0.3);
+  Node *n3=new Node(0.5,1.);               Node *n6=new Node(0.5,0.7);
+  EdgeLin *e1_2=new EdgeLin(n1,n2);        EdgeLin *e4_5=new EdgeLin(n4,n5);
+  EdgeLin *e2_3=new EdgeLin(n2,n3);        EdgeLin *e5_6=new EdgeLin(n5,n6);
+  EdgeLin *e3_1=new EdgeLin(n3,n1);        EdgeLin *e6_4=new EdgeLin(n6,n4);
+  //
+  e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); 
+  QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1);
+  QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4);
+  QuadraticPolygon cpyPol1(pol1); int nbOfSplits=0;
+  cpyPol1.splitPolygonsEachOther(pol1,pol2,nbOfSplits);
+  CPPUNIT_ASSERT_EQUAL(5,pol1.recursiveSize());
+  CPPUNIT_ASSERT_EQUAL(5,pol2.recursiveSize());CPPUNIT_ASSERT_EQUAL(15,nbOfSplits);
+  checkBasicsOfPolygons(pol1,pol2,true);
+  CPPUNIT_ASSERT((*pol2[1])[0]->getEndNode()==(*(*pol1[0])[0])[1]->getEndNode());
+  CPPUNIT_ASSERT((*pol2[1])[0]->getEndNode()->getLoc()==ON_1);
+  CPPUNIT_ASSERT((*pol2[2])[0]->getEndNode()==(*(*pol1[0])[0])[0]->getEndNode());
+  CPPUNIT_ASSERT((*pol2[2])[0]->getEndNode()->getLoc()==ON_1);
+  cpyPol1.performLocatingOperation(pol2);
+  ElementaryEdge *tmp=dynamic_cast<ElementaryEdge *>(pol2[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>((*pol2[1])[0]); CPPUNIT_ASSERT(tmp);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>((*pol2[1])[1]); CPPUNIT_ASSERT(tmp);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_IN_1);
+  tmp=dynamic_cast<ElementaryEdge *>((*pol2[2])[0]); CPPUNIT_ASSERT(tmp);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_IN_1);
+  tmp=dynamic_cast<ElementaryEdge *>((*pol2[2])[1]); CPPUNIT_ASSERT(tmp);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  //clean-up for test1
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  //Deeper test some extremities of pol2 are on edges of pol1.
+
+  n1=new Node(0.,0.);                n4=new Node(1.5,-0.5);   
+  n2=new Node(1.,0.);                n5=new Node(0.5,0.);
+  n3=new Node(0.5,1.);               n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5);
+  //
+  e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e5_4->incrRef(); e4_7->incrRef(); e7_6->incrRef(); e6_5->incrRef();
+  QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_1);
+  QuadraticPolygon pol4; pol4.pushBack(e5_4); pol4.pushBack(e4_7); pol4.pushBack(e7_6); pol4.pushBack(e6_5);
+  QuadraticPolygon cpyPol3(pol3); nbOfSplits=0;
+  cpyPol3.splitPolygonsEachOther(pol3,pol4,nbOfSplits);
+  CPPUNIT_ASSERT_EQUAL(5,pol3.recursiveSize());
+  CPPUNIT_ASSERT_EQUAL(4,pol4.recursiveSize());CPPUNIT_ASSERT_EQUAL(16,nbOfSplits);
+  checkBasicsOfPolygons(pol3,pol4,true);
+  CPPUNIT_ASSERT(pol4[0]->getStartNode()==(*pol3[0])[0]->getEndNode()); CPPUNIT_ASSERT(pol4[0]->getStartNode()==n5);
+  CPPUNIT_ASSERT(n5->getLoc()==ON_LIM_1);
+  CPPUNIT_ASSERT(pol4[2]->getEndNode()==(*pol3[1])[0]->getEndNode()); CPPUNIT_ASSERT(pol4[2]->getEndNode()==n6);
+  CPPUNIT_ASSERT(n6->getLoc()==ON_LIM_1);
+  cpyPol3.performLocatingOperation(pol4);
+  tmp=dynamic_cast<ElementaryEdge *>(pol4[1]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_7);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>(pol4[3]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e6_5);
+  tmp=dynamic_cast<ElementaryEdge *>(pol4[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e5_4);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>(pol4[2]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e7_6);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>(pol4[3]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e6_5);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_IN_1);
+  //clean-up for test2
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e5_4->decrRef(); e4_7->decrRef(); e7_6->decrRef(); e6_5->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); n7->decrRef();
+
+  //Test with one edge of pol2 is included in pol1.
+
+  n1=new Node(0.,0.);                n4=new Node(-0.5,0.);   
+  n2=new Node(1.,0.);                n5=new Node(0.,-1.);
+  n3=new Node(0.5,1.);               n6=new Node(0.5,0.);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+  QuadraticPolygon pol5; pol5.pushBack(e1_2); pol5.pushBack(e2_3); pol5.pushBack(e3_1);
+  QuadraticPolygon pol6; pol6.pushBack(e4_5); pol6.pushBack(e5_6); pol6.pushBack(e6_4);
+  QuadraticPolygon cpyPol5(pol5); nbOfSplits=0;
+  cpyPol5.splitPolygonsEachOther(pol5,pol6,nbOfSplits);
+  CPPUNIT_ASSERT_EQUAL(4,pol5.recursiveSize());
+  CPPUNIT_ASSERT_EQUAL(4,pol6.recursiveSize()); CPPUNIT_ASSERT_EQUAL(13,nbOfSplits);
+  checkBasicsOfPolygons(pol5,pol6,false);
+  CPPUNIT_ASSERT((*pol6[2])[0]->getStartNode()==(*pol5[0])[0]->getEndNode()); CPPUNIT_ASSERT((*pol6[2])[0]->getStartNode()==n6);
+  CPPUNIT_ASSERT(n6->getLoc()==ON_LIM_1);
+  CPPUNIT_ASSERT((*pol6[2])[0]->getEndNode()==(*pol5[0])[0]->getStartNode()); CPPUNIT_ASSERT((*pol5[0])[0]->getStartNode()==n1);
+  CPPUNIT_ASSERT(n1->getLoc()==ON_LIM_1);
+  cpyPol5.performLocatingOperation(pol6);
+  tmp=dynamic_cast<ElementaryEdge *>(pol6[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e4_5);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>(pol6[1]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e5_6);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  tmp=dynamic_cast<ElementaryEdge *>((*pol6[2])[0]); CPPUNIT_ASSERT(tmp);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1);
+  tmp=dynamic_cast<ElementaryEdge *>((*pol6[2])[1]); CPPUNIT_ASSERT(tmp);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_OUT_1);
+  //clean-up test3
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  //Test of full overlapped polygons.
+
+  n1=new Node(0.,0.);                n4=new Node(0.,0.);   
+  n2=new Node(1.,0.);                n5=new Node(1.,0.);
+  n3=new Node(0.5,1.);               n6=new Node(0.5,1.);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+  QuadraticPolygon pol7; pol7.pushBack(e1_2); pol7.pushBack(e2_3); pol7.pushBack(e3_1);
+  QuadraticPolygon pol8; pol8.pushBack(e4_5); pol8.pushBack(e5_6); pol8.pushBack(e6_4);
+  QuadraticPolygon cpyPol7(pol7); nbOfSplits=0;
+  cpyPol7.splitPolygonsEachOther(pol7,pol8,nbOfSplits);
+  tmp=dynamic_cast<ElementaryEdge *>(pol8[0]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e1_2);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1);
+  tmp=dynamic_cast<ElementaryEdge *>(pol8[1]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e2_3);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1);
+  tmp=dynamic_cast<ElementaryEdge *>(pol8[2]); CPPUNIT_ASSERT(tmp); CPPUNIT_ASSERT(tmp->getPtr()==e3_1);
+  CPPUNIT_ASSERT(tmp->getLoc()==FULL_ON_1);
+  //clean-up test4
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+}
+
+void QuadraticPlanarInterpTest::checkBasicsOfPolygons(QuadraticPolygon& pol1, QuadraticPolygon& pol2, bool checkDirection)
+{
+  IteratorOnComposedEdge it1(&pol1),it2(&pol2); it1.previousLoop(); it2.previousLoop();
+  Node *nIter1=it1.current()->getEndNode(); Node *nIter2=it2.current()->getEndNode();
+  for(it2.first();!it2.finished();it2.next())
+    {
+      CPPUNIT_ASSERT(nIter2==it2.current()->getStartNode());
+      if(checkDirection)
+        CPPUNIT_ASSERT(it2.current()->getDirection());
+      nIter2=it2.current()->getEndNode();
+    }
+  for(it1.first();!it1.finished();it1.next())
+    {
+      CPPUNIT_ASSERT(nIter1==it1.current()->getStartNode());
+      if(checkDirection)
+        CPPUNIT_ASSERT(it1.current()->getDirection());
+      nIter1=it1.current()->getEndNode();
+    }
+}
diff --git a/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx b/src/INTERP_KERNEL/Test/QuadraticPlanarInterpTest4.cxx
new file mode 100644 (file)
index 0000000..caba2d4
--- /dev/null
@@ -0,0 +1,1051 @@
+#include "QuadraticPlanarInterpTest.hxx"
+#include "QuadraticPolygon.hxx"
+#include "ElementaryEdge.hxx"
+#include "EdgeArcCircle.hxx"
+#include "EdgeLin.hxx"
+
+#include <cmath>
+#include <sstream>
+#include <iostream>
+
+using namespace std;
+using namespace INTERP_KERNEL;
+
+void QuadraticPlanarInterpTest::checkPolygonsIntersection1()
+{
+   //The "most" basic test1
+  Node *n1=new Node(0.,0.);                Node *n4=new Node(0.,-0.3);   
+  Node *n2=new Node(1.,0.);                Node *n5=new Node(1.,-0.3);
+  Node *n3=new Node(0.5,1.);               Node *n6=new Node(0.5,0.7);
+  EdgeLin *e1_2=new EdgeLin(n1,n2);        EdgeLin *e4_5=new EdgeLin(n4,n5);
+  EdgeLin *e2_3=new EdgeLin(n2,n3);        EdgeLin *e5_6=new EdgeLin(n5,n6);
+  EdgeLin *e3_1=new EdgeLin(n3,n1);        EdgeLin *e6_4=new EdgeLin(n6,n4);
+  //
+  vector<QuadraticPolygon *> result;
+  for(int k=0;k<2;k++)
+    for(int i=0;i<1;i++)
+      {
+        for(int j=0;j<1;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef(); 
+            QuadraticPolygon pol1; pol1.circularPermute(); pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol1.circularPermute(); if(k==1) pol1.reverse();
+            QuadraticPolygon pol2; pol2.pushBack(e4_5); pol2.pushBack(e5_6); pol2.pushBack(e6_4);
+            for(int j1=0;j1<j;j1++) pol2.circularPermute();
+            result=pol1.intersectMySelfWith(pol2);
+            CPPUNIT_ASSERT_EQUAL(1,(int)result.size()); checkBasicsOfPolygons(*result[0],*result[0],false);
+            CPPUNIT_ASSERT_EQUAL(3,result[0]->recursiveSize());
+            delete result[0];
+          }
+      }
+  //clean-up for test1
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  //Deeper test some extremities of pol2 are on edges of pol1.
+
+  n1=new Node(0.,0.);                n4=new Node(1.5,-0.5);   
+  n2=new Node(1.,0.);                n5=new Node(0.5,0.);
+  n3=new Node(0.5,1.);               n6=new Node(0.75,0.5); Node *n7=new Node(2.,0.5);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  EdgeLin *e5_4=new EdgeLin(n5,n4); EdgeLin *e4_7=new EdgeLin(n4,n7); EdgeLin *e7_6=new EdgeLin(n7,n6); EdgeLin *e6_5=new EdgeLin(n6,n5);
+  //
+  for(int k=0;k<2;k++)
+    for(int i=0;i<3;i++)
+      {
+        for(int j=0;j<4;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e5_4->incrRef(); e4_7->incrRef(); e7_6->incrRef(); e6_5->incrRef();
+            QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol3.circularPermute(); if(k==1) pol3.reverse();
+            QuadraticPolygon pol4; pol4.pushBack(e5_4); pol4.pushBack(e4_7); pol4.pushBack(e7_6); pol4.pushBack(e6_5);
+            for(int j1=0;j1<j;j1++) pol4.circularPermute();
+            result=pol3.intersectMySelfWith(pol4);
+            CPPUNIT_ASSERT_EQUAL(1,(int)result.size()); checkBasicsOfPolygons(*result[0],*result[0],false);
+            CPPUNIT_ASSERT_EQUAL(3,result[0]->recursiveSize());
+            delete result[0];          
+          }
+      }
+  //clean-up for test2
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e5_4->decrRef(); e4_7->decrRef(); e7_6->decrRef(); e6_5->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); n7->decrRef();
+
+  //Test with one edge of pol2 is included in pol1.
+
+  n1=new Node(0.,0.);                n4=new Node(-0.5,0.);   
+  n2=new Node(1.,0.);                n5=new Node(0.,-1.);
+  n3=new Node(0.5,1.);               n6=new Node(0.5,0.);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  for(int k=0;k<2;k++)
+    for(int i=0;i<3;i++)
+      {
+        for(int j=0;j<3;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+            QuadraticPolygon pol5; pol5.pushBack(e1_2); pol5.pushBack(e2_3); pol5.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol5.circularPermute(); if(k==1) pol5.reverse();
+            QuadraticPolygon pol6; pol6.pushBack(e4_5); pol6.pushBack(e5_6); pol6.pushBack(e6_4);
+            for(int j1=0;j1<j;j1++) pol6.circularPermute();
+            result=pol5.intersectMySelfWith(pol6);
+            CPPUNIT_ASSERT_EQUAL(0,(int)result.size());
+          }
+      }
+  //clean-up test3
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  //Test of full overlapped polygons.
+
+  n1=new Node(0.,0.);                n4=new Node(0.,0.);   
+  n2=new Node(1.,0.);                n5=new Node(1.,0.);
+  n3=new Node(0.5,1.);               n6=new Node(0.5,1.);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  for(int k=0;k<2;k++)
+    for(int i=0;i<3;i++)
+      {
+        for(int j=0;j<3;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+            QuadraticPolygon pol7; pol7.pushBack(e1_2); pol7.pushBack(e2_3); pol7.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol7.circularPermute(); if(k==1) pol7.reverse();
+            QuadraticPolygon pol8; pol8.pushBack(e4_5); pol8.pushBack(e5_6); pol8.pushBack(e6_4);
+            for(int j1=0;j1<j;j1++) pol8.circularPermute();
+            result=pol7.intersectMySelfWith(pol8);
+            CPPUNIT_ASSERT_EQUAL(1,(int)result.size()); checkBasicsOfPolygons(*result[0],*result[0],false);
+            CPPUNIT_ASSERT_EQUAL(3,result[0]->recursiveSize());
+            delete result[0];
+          }
+      }
+  //clean-up test4
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  //Test of closing process
+  
+  n1=new Node(0.,0.);                n4=new Node(0.539,-0.266);   
+  n2=new Node(1.,0.);                n5=new Node(1.039,0.6);
+  n3=new Node(0.5,1.);               n6=new Node(-0.077,0.667);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  for(int k=0;k<2;k++)
+    for(int i=0;i<3;i++)
+      {
+        for(int j=0;j<3;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+            QuadraticPolygon pol9; pol9.pushBack(e1_2); pol9.pushBack(e2_3); pol9.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol9.circularPermute(); if(k==1) pol9.reverse();
+            QuadraticPolygon pol10; pol10.pushBack(e5_6); pol10.pushBack(e6_4); pol10.pushBack(e4_5);
+            for(int j1=0;j1<j;j1++) pol10.circularPermute();
+            result=pol9.intersectMySelfWith(pol10);
+            CPPUNIT_ASSERT_EQUAL(1,(int)result.size()); checkBasicsOfPolygons(*result[0],*result[0],false);
+            CPPUNIT_ASSERT_EQUAL(6,result[0]->recursiveSize());
+            delete result[0];
+          }
+      }
+  //clean-up test5
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  // Full in case
+
+  n1=new Node(0.,0.);                n4=new Node(0.3,0.1);   
+  n2=new Node(1.,0.);                n5=new Node(0.7,0.1);
+  n3=new Node(0.5,1.);               n6=new Node(0.5,0.7);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  for(int k=0;k<2;k++)
+    for(int i=0;i<3;i++)
+      {
+        for(int j=0;j<3;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+            QuadraticPolygon pol11; pol11.pushBack(e1_2); pol11.pushBack(e2_3); pol11.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol11.circularPermute(); if(k==1) pol11.reverse();
+            QuadraticPolygon pol12; pol12.pushBack(e5_6); pol12.pushBack(e6_4); pol12.pushBack(e4_5);
+            for(int j1=0;j1<j;j1++) pol12.circularPermute();
+            result=pol11.intersectMySelfWith(pol12);
+            CPPUNIT_ASSERT_EQUAL(1,(int)result.size()); checkBasicsOfPolygons(*result[0],*result[0],false);
+            CPPUNIT_ASSERT_EQUAL(3,result[0]->recursiveSize());
+            delete result[0];
+          }
+      }
+  //clean-up test6
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  // Full out case
+
+  n1=new Node(0.,0.);                n4=new Node(-2,0.);   
+  n2=new Node(1.,0.);                n5=new Node(-1.,0.);
+  n3=new Node(0.5,1.);               n6=new Node(-1.5,1.);
+  e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); e3_1=new EdgeLin(n3,n1);
+  e4_5=new EdgeLin(n4,n5); e5_6=new EdgeLin(n5,n6); e6_4=new EdgeLin(n6,n4);
+  for(int k=0;k<2;k++)
+    for(int i=0;i<3;i++)
+      {
+        for(int j=0;j<3;j++)
+          {
+            e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef(); e4_5->incrRef(); e5_6->incrRef(); e6_4->incrRef();
+            QuadraticPolygon pol13; pol13.pushBack(e1_2); pol13.pushBack(e2_3); pol13.pushBack(e3_1);
+            for(int i1=0;i1<i;i1++) pol13.circularPermute(); if(k==1) pol13.reverse();
+            QuadraticPolygon pol14; pol14.pushBack(e5_6); pol14.pushBack(e6_4); pol14.pushBack(e4_5);
+            for(int j1=0;j1<j;j1++) pol14.circularPermute();
+            result=pol13.intersectMySelfWith(pol14);
+            CPPUNIT_ASSERT_EQUAL(0,(int)result.size());
+          }
+      }
+  //clean-up test7
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef(); e4_5->decrRef(); e5_6->decrRef(); e6_4->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef();
+
+  //Multi polygons
+  
+   n1=new Node(0.,0.);
+   n2=new Node(1.,0.);
+   n3=new Node(1.,1.);
+   n4=new Node(0.,1.);
+   //
+   n5=new Node(0.2,0.7);
+   n6=new Node(0.4,0.7);
+   n7=new Node(0.4,1.3);
+   Node *n8=new Node(0.6,1.3);
+   Node *n9=new Node(0.6,0.7);
+   Node *n10=new Node(0.9,0.7);
+   Node *n11=new Node(0.9,2.);
+   Node *n12=new Node(0.2,2.);
+   //
+   e1_2=new EdgeLin(n1,n2); e2_3=new EdgeLin(n2,n3); Edge *e3_4=new EdgeLin(n3,n4); Edge *e4_1=new EdgeLin(n4,n1);
+   e5_6=new EdgeLin(n5,n6); Edge *e6_7=new EdgeLin(n6,n7); Edge *e7_8=new EdgeLin(n7,n8); Edge *e8_9=new EdgeLin(n8,n9); Edge *e9_10=new EdgeLin(n9,n10); Edge *e10_11=new EdgeLin(n10,n11);
+   Edge *e11_12=new EdgeLin(n11,n12); Edge *e12_1=new EdgeLin(n12,n5);
+   //
+   for(int k=0;k<2;k++)
+     for(int i=0;i<4;i++)
+       {
+         for(int j=0;j<8;j++)
+           {
+             e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_1->incrRef(); e5_6->incrRef(); e6_7->incrRef(); e7_8->incrRef(); e8_9->incrRef(); e9_10->incrRef(); e10_11->incrRef(); e11_12->incrRef(); e12_1->incrRef();
+             QuadraticPolygon pol15; pol15.pushBack(e1_2); pol15.pushBack(e2_3); pol15.pushBack(e3_4); pol15.pushBack(e4_1);
+             for(int i1=0;i1<i;i1++) pol15.circularPermute(); if(k==1) pol15.reverse();
+             QuadraticPolygon pol16; pol16.pushBack(e5_6); pol16.pushBack(e6_7); pol16.pushBack(e7_8); pol16.pushBack(e8_9); pol16.pushBack(e9_10); pol16.pushBack(e10_11); pol16.pushBack(e11_12); pol16.pushBack(e12_1);
+             for(int j1=0;j1<j;j1++) pol16.circularPermute();
+             result=pol15.intersectMySelfWith(pol16);
+             CPPUNIT_ASSERT_EQUAL(2,(int)result.size());
+             checkBasicsOfPolygons(*result[0],*result[1],false);
+             CPPUNIT_ASSERT_EQUAL(4,result[0]->recursiveSize()); CPPUNIT_ASSERT_EQUAL(4,result[1]->recursiveSize());
+             CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15,result[0]->getAreaFast()+result[1]->getAreaFast(),1e-10);
+             CPPUNIT_ASSERT_DOUBLES_EQUAL(0.03,fabs(result[0]->getAreaFast()-result[1]->getAreaFast()),1e-10);
+             CPPUNIT_ASSERT_DOUBLES_EQUAL(0.15,pol15.intersectWith(pol16),1e-10);
+             delete result[0]; delete result[1];
+           }
+       }
+   //clean-up test8
+   e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_1->decrRef(); e5_6->decrRef(); e6_7->decrRef(); e7_8->decrRef(); e8_9->decrRef(); e9_10->decrRef(); e10_11->decrRef(); e11_12->decrRef(); e12_1->decrRef();
+   n1->decrRef(); n2->decrRef(); n3->decrRef(); n4->decrRef(); n5->decrRef(); n6->decrRef(); n7->decrRef(); n8->decrRef(); n9->decrRef(); n10->decrRef(); n11->decrRef(); n12->decrRef();
+}
+
+void QuadraticPlanarInterpTest::checkAreasCalculations()
+{
+  Node *n1=new Node(0.,0.);
+  Node *n2=new Node(1.,0.);
+  Node *n3=new Node(0.5,1.);
+  Edge *e1_2=new EdgeLin(n1,n2);
+  Edge *e2_3=new EdgeLin(n2,n3);
+  Edge *e3_1=new EdgeLin(n3,n1);
+  //
+  e1_2->incrRef(); e2_3->incrRef(); e3_1->incrRef();
+  QuadraticPolygon pol1; pol1.pushBack(e1_2); pol1.pushBack(e2_3); pol1.pushBack(e3_1);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,pol1.getAreaFast(),1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.2360679774997898,pol1.getPerimeterFast(),1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.61803398874989479,pol1.getHydraulicDiameter(),1e-10);
+  pol1.reverse();
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.5,pol1.getAreaFast(),1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3.2360679774997898,pol1.getPerimeterFast(),1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.61803398874989479,pol1.getHydraulicDiameter(),1e-10);
+  //clean-up
+  e1_2->decrRef(); e2_3->decrRef(); e3_1->decrRef();
+  n1->decrRef(); n2->decrRef(); n3->decrRef();
+
+  //case 2
+
+  n1=new Node(0.,0.);
+  n2=new Node(1.,0.);
+  Node *n3m=new Node(1.5,0.5);
+  n3=new Node(1.,1.);
+  Node *n4=new Node(0.,1.);
+  e1_2=new EdgeLin(n1,n2);
+  e2_3=new EdgeArcCircle(n2,n3m,n3);
+  Edge *e3_4=new EdgeLin(n3,n4);
+  Edge *e4_1=new EdgeLin(n4,n1);
+  //
+  for(int k=0;k<8;k++)
+    {
+      n2->setNewCoords(cos(k*M_PI/4),sin(k*M_PI/4));
+      n3->setNewCoords(sqrt(2.)*cos((k+1)*M_PI/4),sqrt(2.)*sin((k+1)*M_PI/4));
+      n3m->setNewCoords(1.5811388300841898*cos(0.3217505543966423+k*M_PI/4),1.5811388300841898*sin(0.3217505543966423+k*M_PI/4));
+      n4->setNewCoords(cos(k*M_PI/4+M_PI/2),sin(k*M_PI/4+M_PI/2));
+      e1_2->update(n3m); e2_3->update(n3m); e3_4->update(n3m); e4_1->update(n3m);
+      e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_1->incrRef();
+      QuadraticPolygon pol2; pol2.pushBack(e1_2); pol2.pushBack(e2_3); pol2.pushBack(e3_4); pol2.pushBack(e4_1);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(1.3926990816987241,pol2.getAreaFast(),1e-6);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(4.5707963267948966,pol2.getPerimeterFast(),1e-6);
+      pol2.reverse();
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.3926990816987241,pol2.getAreaFast(),1e-6);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(4.5707963267948966,pol2.getPerimeterFast(),1e-6);
+    }
+  //clean-up case2
+  e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_1->decrRef(); 
+  n1->decrRef(); n2->decrRef(); n3->decrRef(); n3m->decrRef(); n4->decrRef();
+  
+  //case 3
+
+  const double radius1=0.7;
+  const double radius2=0.9;
+  n1=new Node(1.+radius1*cos(-2.*M_PI/3.),1.+radius1*sin(-2.*M_PI/3.));
+  n2=new Node(1.+radius1*cos(-M_PI/3.),1.+radius1*sin(-M_PI/3.));
+  Node *n2m=new Node(1.+radius1*cos(M_PI/2.),1.+radius1*sin(M_PI/2.));
+  n3=new Node(1.+radius2*cos(-M_PI/3.),1.+radius2*sin(-M_PI/3.));
+  n3m=new Node(1.+radius2*cos(M_PI/2.),1.+radius2*sin(M_PI/2.));
+  n4=new Node(1.+radius2*cos(-2.*M_PI/3.),1.+radius2*sin(-2.*M_PI/3.));
+  e1_2=new EdgeArcCircle(n1,n2m,n2);
+  e2_3=new EdgeLin(n2,n3);
+  e3_4=new EdgeArcCircle(n3,n3m,n4);
+  e4_1=new EdgeLin(n4,n1);
+  //
+  e1_2->incrRef(); e2_3->incrRef(); e3_4->incrRef(); e4_1->incrRef();
+  QuadraticPolygon pol3; pol3.pushBack(e1_2); pol3.pushBack(e2_3); pol3.pushBack(e3_4); pol3.pushBack(e4_1);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.83775804095727857,pol3.getAreaFast(),1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(8.7775804095727832,pol3.getPerimeterFast(),1e-10);
+  pol3.reverse();
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.83775804095727857,pol3.getAreaFast(),1e-10);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(8.7775804095727832,pol3.getPerimeterFast(),1e-10);
+  //clean-up case3
+  e1_2->decrRef(); e2_3->decrRef(); e3_4->decrRef(); e4_1->decrRef(); 
+  n1->decrRef(); n2->decrRef(); n2m->decrRef(); n3->decrRef(); n3m->decrRef(); n4->decrRef();
+}
+
+/*!
+ * Testing user interface high level function.
+ */
+void QuadraticPlanarInterpTest::checkHighLevelFunctionTest1()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-12);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+  double coords[]={
+    8.8334591186000004, 5.0999999999999996,
+    7.1014083111000001, 6.0999999999999996,
+    7.8334591186000004, 6.8320508074999999,
+    7.9674337149000003, 5.5999999999999996,
+    7.4192455562999999, 6.5142135623000001,
+    8.3334591186000004, 5.9660254036999998
+  };
+  vector<Node *> nodes;
+  nodes.push_back(new Node(coords));
+  nodes.push_back(new Node(coords+2));
+  nodes.push_back(new Node(coords+4));
+  nodes.push_back(new Node(coords+6));
+  nodes.push_back(new Node(coords+8));
+  nodes.push_back(new Node(coords+10));
+  QuadraticPolygon *pol=QuadraticPolygon::buildArcCirclePolygon(nodes);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(-1.04719755,pol->getAreaFast(),1e-5);
+  CPPUNIT_ASSERT_EQUAL(3,pol->size());
+  ElementaryEdge *e0=dynamic_cast<ElementaryEdge *>((*pol)[0]);
+  ElementaryEdge *e1=dynamic_cast<ElementaryEdge *>((*pol)[1]);
+  ElementaryEdge *e2=dynamic_cast<ElementaryEdge *>((*pol)[0]);
+  CPPUNIT_ASSERT(e0); CPPUNIT_ASSERT(e1); CPPUNIT_ASSERT(e2);
+  CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));//<- testing detection of colinearity
+  CPPUNIT_ASSERT(dynamic_cast<EdgeArcCircle *>(e1->getPtr()));
+  CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e2->getPtr()));//<- testing detection of colinearity
+  nodes.clear();
+  delete pol;
+  nodes.push_back(new Node(coords));
+  nodes.push_back(new Node(coords+4));
+  nodes.push_back(new Node(coords+2));
+  nodes.push_back(new Node(coords+10));
+  nodes.push_back(new Node(coords+8));
+  nodes.push_back(new Node(coords+6));
+  pol=QuadraticPolygon::buildArcCirclePolygon(nodes);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.04719755,pol->getAreaFast(),1e-5);
+  CPPUNIT_ASSERT_EQUAL(3,pol->size());
+  e0=dynamic_cast<ElementaryEdge *>((*pol)[0]);
+  e1=dynamic_cast<ElementaryEdge *>((*pol)[1]);
+  e2=dynamic_cast<ElementaryEdge *>((*pol)[0]);
+  CPPUNIT_ASSERT(e0); CPPUNIT_ASSERT(e1); CPPUNIT_ASSERT(e2);
+  CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e0->getPtr()));//<- testing detection of colinearity
+  CPPUNIT_ASSERT(dynamic_cast<EdgeArcCircle *>(e1->getPtr()));
+  CPPUNIT_ASSERT(dynamic_cast<EdgeLin *>(e2->getPtr()));//<- testing detection of colinearity
+  delete pol;
+  const double coords2[]={
+    0.,0.,
+    1.5,0.,
+    1.5,1.,
+    0.,1.
+  };
+  nodes.clear();
+  nodes.push_back(new Node(coords2));
+  nodes.push_back(new Node(coords2+2));
+  nodes.push_back(new Node(coords2+4));
+  nodes.push_back(new Node(coords2+6));
+  pol=QuadraticPolygon::buildLinearPolygon(nodes);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5,pol->getAreaFast(),1e-12);
+  double tmp[2],tmp2;
+  pol->getBarycenter(tmp,tmp2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.75,tmp[0],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,tmp[1],1e-12);
+  delete pol;
+  const double coords3[]={
+    1.0999999999000001, -1.9052558882999999,
+    1.9052558881999999, -1.0999999999000001,
+    1.7320508075000001, -0.99999999989999999,
+    0.99999999989999999, -1.7320508075000001,
+    1.5556349186, -1.5556349185,
+    1.8186533478, -1.0499999999,
+    1.4142135623000001, -1.4142135623000001,
+    1.0499999999, -1.8186533479
+  };
+  nodes.clear();
+  nodes.push_back(new Node(coords3));
+  nodes.push_back(new Node(coords3+2));
+  nodes.push_back(new Node(coords3+4));
+  nodes.push_back(new Node(coords3+6));
+  nodes.push_back(new Node(coords3+8));
+  nodes.push_back(new Node(coords3+10));
+  nodes.push_back(new Node(coords3+12));
+  nodes.push_back(new Node(coords3+14));
+  pol=QuadraticPolygon::buildArcCirclePolygon(nodes);
+  pol->getBarycenter(tmp,tmp2);
+  delete pol;
+  QUADRATIC_PLANAR::setPrecision(1e-14);
+}
+
+void QuadraticPlanarInterpTest::check1DInterpLin()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-7);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+  const int NB_OF_CELL_AXIAL_1=30;
+  static const double Z_VALS_1[NB_OF_CELL_AXIAL_1+1]=
+    { -0.1550 , -0.1356, -0.1162, -0.0969, -0.0775 ,-0.0581, -0.0387, -0.0194,  0.0000 , 0.0500, 
+      0.1000 , 0.1500 , 0.2000 , 0.2500,  0.3000,  0.3500,  0.4000,  0.4500,  0.5000,  0.5500, 
+      0.6000,  0.6500,  0.7000,  0.7194,  0.7388,  0.7581,  0.7775,  0.7969,  0.8163,  0.8356, 
+      0.8550};
+  vector<double> zLev1(Z_VALS_1,Z_VALS_1+NB_OF_CELL_AXIAL_1+1);
+
+  const int NB_OF_CELL_AXIAL_2=46;
+  static const double Z_VALS_2[NB_OF_CELL_AXIAL_2+1]=
+    { -0.3050 ,-0.2863,-0.2675,-0.2488,-0.2300,-0.2113,-0.1925,-0.1738,-0.1550,-0.1356  
+      , -0.1162,-0.0969,-0.0775,-0.0581,-0.0387,-0.0194,0.0000, 0.0500, 0.1 ,0.15 
+      ,  0.20,  0.25, 0.30, 0.350 ,0.40 ,0.450 ,0.500 , 0.550, 0.600 ,0.650 ,0.700
+      , 0.7194 ,0.7388 ,0.7581 ,0.7775 ,0.7969 ,0.8163 ,0.8356, 0.8550
+      ,  0.8738 ,0.8925 ,0.9113 ,0.9300 ,0.9488 ,0.9675 ,0.9863, 1.0050};
+  vector<double> zLev2(Z_VALS_2,Z_VALS_2+NB_OF_CELL_AXIAL_2+1);
+  map<int,map<int,double> > m;
+  Edge::interpolate1DLin(zLev1,zLev2,m);
+  CPPUNIT_ASSERT_EQUAL(30,(int)m.size());
+  double ret=0;
+  for(int i=0;i<30;i++)
+    {
+      CPPUNIT_ASSERT_EQUAL(1,(int)m[i].size());
+      CPPUNIT_ASSERT(m[i][8+i] > 0.15);
+      ret+=m[i][8+i];
+    }
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(ret,30.,1e-12);
+  //
+  m.clear();
+  const int NB_OF_CELL_AXIAL_3=13;
+  static const double Z_VALS_3[NB_OF_CELL_AXIAL_3+1]={
+    0.,0.01,0.05,0.10,0.15,0.20,0.25,0.30,
+    0.35,0.40,0.45,0.50,0.55,0.60 };
+  vector<double> zLev3(Z_VALS_3,Z_VALS_3+NB_OF_CELL_AXIAL_3+1);
+  Edge::interpolate1DLin(zLev3,zLev1,m);
+  CPPUNIT_ASSERT_EQUAL(13,(int)m.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[0][8],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[1][8],1e-12);
+  for(int i=0;i<11;i++)
+    {
+      CPPUNIT_ASSERT_EQUAL(1,(int)m[i+2].size());
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,m[i+2][i+9],1e-12);
+    }
+  QUADRATIC_PLANAR::setPrecision(1e-14);
+}
+
+/*!
+ * Tests to avoid regressions : Basic one.
+ */
+void QuadraticPlanarInterpTest::checkNonRegression1()
+{
+  const double coords1[]=
+    {
+      16.1732057215, -25.110999999800001,
+      16.02555485246479, -25.340997988918762
+    };
+  Node *nS1=new Node(coords1);
+  Node *nE1=new Node(coords1+2);
+  const double radius1=2.902;
+  const double angleS1=-0.49999999950907054; const double angleL1=-0.0942156629996692;
+  const double center1[2]={13.66, -23.66};
+  EdgeArcCircle *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1);
+  //
+  const double coords2[]=
+    {
+      16.041579804000001, -25.350249998999999,
+      16.367740958999999, -24.132999999999999
+    };
+  Node *nS2=new Node(coords2);
+  Node *nE2=new Node(coords2+2);
+  const double radius2=2.4345;
+  const double angleS2=-0.523598776190207; const double angleL2=0.5235987755846041;
+  const double center2[]={ 13.933240960547204, -24.132999998525658 };
+  EdgeArcCircle *e2=new EdgeArcCircle(nS2,nE2,center2,radius2,angleS2,angleL2);
+  MergePoints merge;
+  QuadraticPolygon c1,c2;
+  e1->intersectWith(e2,merge,c1,c2);
+  CPPUNIT_ASSERT_EQUAL(2,c1.size()); CPPUNIT_ASSERT_EQUAL(2,c2.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(e1->getCurveLength(),c1.getPerimeterFast(),1e-5);
+  //clean-up
+  nS1->decrRef(); nE1->decrRef(); nS2->decrRef(); nE2->decrRef(); e1->decrRef(); e2->decrRef();
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression2()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-12);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+  double coords1[]=
+    {
+      15.141499999899999, -26.226033271399999,
+      16.226033271199999, -25.141499999800001,
+      16.1732057215, -25.110999999800001,
+      15.110999999899999, -26.1732057217,
+      15.755157392699999, -25.755157392499999,
+      16.199619496299999, -25.126249999799999,
+      15.7120238788, -25.712023879099998,
+      15.126249999899999, -26.199619496499999
+    };
+  double coords2[]=
+    {
+      15.933240959000001, -24.132999999999999,
+      15.665291765999999, -25.132999998999999,
+      16.041579804000001, -25.350249998999999,
+      16.367740958999999, -24.132999999999999,
+      15.865092611, -24.650638091000001,
+      15.853435785, -25.241624998999999,
+      16.284787383000001, -24.763094964,
+      16.150490958999999, -24.132999999999999
+    };
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00173945,v[0]->getAreaFast(),1e-7);
+  delete v[0];
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00173945,pol1->intersectWith(*pol2),1e-7);
+  delete pol1;
+  delete pol2;
+}
+
+/*!
+ * Tests to avoid regressions : Basic one.
+ */
+void QuadraticPlanarInterpTest::checkNonRegression3()
+{
+  const double coords1[]=
+    {
+      10.962340811000001, -22.417749999000002,
+      12.217990959, -21.162099852000001
+    };
+  Node *nS1=new Node(coords1);
+  Node *nE1=new Node(coords1+2);
+  const double radius1=3.4304999897666599;
+  const double angleS1=2.6179938783536514; const double angleL1=-0.52359877711901204;
+  const double center1[2]={13.933240950441375, -24.132999992807399};
+  EdgeArcCircle *e1=new EdgeArcCircle(nS1,nE1,center1,radius1,angleS1,angleL1);
+  //
+  const double coords2[]=
+    {
+      11.1467942784, -22.2090000002,
+      11.0939667286, -22.178500000099998
+    };
+  Node *nS2=new Node(coords2);
+  Node *nE2=new Node(coords2+2);
+  EdgeLin *e2=new EdgeLin(nS2,nE2);
+  MergePoints merge;
+  QuadraticPolygon c1,c2;
+  CPPUNIT_ASSERT(e1->intersectWith(e2,merge,c1,c2));
+  CPPUNIT_ASSERT_EQUAL(2,c1.size());
+  CPPUNIT_ASSERT_EQUAL(2,c2.size());
+  ElementaryEdge *tmp1=dynamic_cast<ElementaryEdge *>(c1.front()); CPPUNIT_ASSERT(tmp1);
+  EdgeArcCircle *tmp2=dynamic_cast<EdgeArcCircle *>(tmp1->getPtr()); CPPUNIT_ASSERT(tmp2);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.6179938783536514,tmp2->getAngle0(),1e-14);
+  //clean-up
+  nS1->decrRef(); nE1->decrRef(); nS2->decrRef(); nE2->decrRef(); e1->decrRef(); e2->decrRef();
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression4()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-12);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-9);
+  double coords1[]=
+    {
+      10.962340811000001, -22.417749999000002,
+      12.217990959, -21.162099852000001,
+      12.051990958999999, -20.874579418,
+      10.674820377, -22.251749999000001,
+      11.507511146000001, -21.707270185999999,
+      12.134990959, -21.018339635,
+      11.272751694, -21.472510735,
+      10.818580594, -22.334749999
+    };
+
+  double coords2[]=
+    {
+      10.758000000199999, -23.66,
+      11.1467942784, -22.2090000002,
+      11.0939667286, -22.178500000099998,
+      10.696999999999999, -23.66,
+      10.856883252299999, -22.908907131159999,
+      11.1203805035, -22.1937500001,
+      10.797961776699999, -22.893119169449999,
+      10.727500000099999, -23.66
+    };
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00164773941455998,v[0]->getAreaFast(),1e-7);
+  delete v[0];
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00164773941455998,pol1->intersectWith(*pol2),1e-7);
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression5()
+{
+  INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-12);
+  INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+  double coords1[]=
+    {
+      -1.7320508075000001, 1,
+      -1, 1.7320508075000001 ,
+      -1.2172499999999999, 2.1083388455000001,
+      -2.1083388455000001, 1.2172499999999999,
+      -1.4142135623000001, 1.4142135623000001,
+      -1.108625, 1.9201948265,
+      -1.7214514588000001, 1.7214514588000001,
+      -1.9201948265, 1.108625};
+
+  double coords2[]=
+    {
+      -2.2379999998, 0,
+      -1.9381648534, 1.1189999998,
+      -1.9909924031999999, 1.1494999999,
+      -2.2989999998999999, 0,
+      -2.1617419990000002, 0.57923702298000002,
+      -1.9645786283, 1.1342499998,
+      -2.2206634745999998, 0.59502498461999997,
+      -2.2684999997999999, 0};
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  pol1->dumpInXfigFileWithOther(*pol2,"this.fig");
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
+  //CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00164773941455998,v[0]->getAreaFast(),1e-7);
+  //delete v[0];
+  //CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00164773941455998,pol1->intersectWith(*pol2),1e-7);
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression6()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-12);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+  double coords1[]=
+    {
+      10.962340811000001, -22.417749999000002,
+      12.217990959, -21.162099852000001,
+      12.051990958999999, -20.874579418,
+      10.674820377, -22.251749999000001,
+      11.507511146000001, -21.707270185999999,
+      12.134990959, -21.018339635,
+      11.272751694, -21.472510735,
+      10.818580594, -22.334749999
+    };
+  double coords2[]=
+    { 10.426, -23.66,
+      10.859273844199999, -22.043000000100001,
+      10.806446294799999, -22.012500000199999,
+      10.3650000002, -23.66,
+      10.536195877799999, -22.822979208099998,
+      10.832860069499999, -22.027750000200001,
+      10.477274402499999, -22.80719124657,
+      10.3955000001, -23.66};
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(v[0]->getAreaOfZone(),0.0150659,1e-7);
+  delete v[0];
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression7()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-5);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+  double coords1[]=
+    {
+      -2., 0,
+      -1.7320508075000001, 1,
+      -2.1083388455000001, 1.2172499999999999,
+      -2.4344999999999999, 0,
+      -1.9318516525603098, 0.51763809027157182,
+      -1.9201948265, 1.108625,
+      -2.3515464241024469, 0.63009496529570408,
+      -2.2172499999999999, 0
+    };
+  double coords2[]=
+    { -2.3369999999000002, 0,
+      -2.0239013684999998, 1.1684999999000001,
+      -2.1927763221999998, 1.2659999998,
+      -2.5319999998, 0,
+      -2.2573686559260442, 0.60486010843437632,
+      -2.1083388453499996, 1.2172499998499999,
+      -2.445724191994314, 0.65532982205982326,
+      -2.4344999998499999, 0 };
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.121795,v[0]->getAreaOfZone(),1.e-6);
+  delete v[0];
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression8()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-3);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-5);
+  double coords1[]=
+    {
+      -13.933240959000001, -28.559499999,
+      -16.146490959000001, -27.966461449000001,
+      -16.383240958999998, -28.376524478,
+      -13.933240959000001, -29.032999999000001,
+      -15.078903461873765, -28.408670669106311,
+      -16.264865958999998, -28.1714929635,
+      -15.201454280317435, -28.866036547696734,
+      -13.933240959000001, -28.796249999 };
+  double coords2[]=
+    { -16.382999999950002, -28.376524478457149,
+      -13.933000000014729, -29.03299999982551,
+      -13.93300000006697, -28.793999999915993,
+      -16.263500000000001, -28.169544407039268,
+      -15.201213320921273, -28.866036548734634,
+      -13.933000000040851, -28.913499999870751,
+      -15.139355569325469, -28.635180276305853,
+      -16.323249999975001, -28.273034442748209 };
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0.598232,v[0]->getAreaOfZone(),1.e-6);
+  delete v[0];
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression9()
+{
+  QUADRATIC_PLANAR::setPrecision(1e-7);
+  QUADRATIC_PLANAR::setArcDetectionPrecision(1e-8);
+  double coords1[]=
+    {
+      -0.04476229252902969, -0.085118027765365603,
+      -0.046952683430894329, -0.085704941238358354,
+      -0.046952683430894329, -0.088063823748058725,
+      -0.043582851274179504, -0.087160879944491371,
+      -0.045818853668170414, -0.085555669718918592,
+      -0.046952683430894329, -0.086884382493208526,
+      -0.045208329947517549, -0.087834175256748526,
+      -0.044172571901604597, -0.086139453854928494 };
+
+  double coords2[]=
+    { -0.05065868681155701, -0.087744551996665671,
+      -0.046951871439587615, -0.088737790182236015,
+      -0.046951871439683469, -0.088063823751059062,
+      -0.050321703596054014, -0.087160879946116557,
+      -0.0488706602695924, -0.08848517684025306,
+      -0.046951871439635542, -0.088400806966647538,
+      -0.048696224921445964, -0.087834175258503858,
+      -0.050490195203805516, -0.087452715971391121};
+
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression10()
+{
+  INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
+  INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+  double coords1[]=
+    { -0.002269581957210453, -0.09851030343724453,
+      -0.004268022334182935, -0.1059685844580936,
+      -0.002777851483521377, -0.1023709937816271};
+  double coords2[]=
+    { -0.004114727297178323, -0.1049870239624718,
+      -0.003544545103522544, -0.1053162188055505};
+  Node *n1_1=new Node(coords1);
+  Node *n2_1=new Node(coords1+2);
+  Node *n3_1=new Node(coords1+4);
+  Node *n1_2=new Node(coords2);
+  Node *n2_2=new Node(coords2+2);
+  EdgeArcCircle *e1=new EdgeArcCircle(n1_1,n3_1,n2_1);
+  EdgeLin *e2=new EdgeLin(n1_2,n2_2);
+  MergePoints merge;
+  ComposedEdge *c1=new ComposedEdge;
+  ComposedEdge *c2=new ComposedEdge;
+  CPPUNIT_ASSERT(e1->intersectWith(e2,merge,*c1,*c2));
+  CPPUNIT_ASSERT_EQUAL(2,c1->size());
+  CPPUNIT_ASSERT_EQUAL(2,c2->size());
+  ComposedEdge::Delete(c1); ComposedEdge::Delete(c2);
+  n1_1->decrRef(); n2_1->decrRef(); n3_1->decrRef();
+  n1_2->decrRef(); n2_2->decrRef();
+  e1->decrRef(); e2->decrRef();
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression11()
+{
+  INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-7);
+  INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+  double coords1[]=
+    { -0.002269581957210453, -0.09851030343724453,
+      -0.004268022334182935, -0.1059685844580936,
+      -0.002886178753789801, -0.1067663922211958,
+      -0.0006739664310059821, -0.09851030343724453,
+      -0.002777851483521377, -0.1023709937816271,
+      -0.003577100543986368, -0.1063674883396447,
+      -0.001236605237717319, -0.1027839694676665,
+      -0.001471774194108217, -0.09851030343724453};
+  double coords2[]=
+    { -0.003544545103522544, -0.1053162188055505,
+      -0.001941023322604723, -0.09851030343724451,
+      -0.002598140593501099, -0.09851030343724451,
+      -0.004114727297178323, -0.1049870239624718,
+      -0.002347317802266182, -0.1020064358043286,
+      -0.002269581958052911, -0.09851030343724451,
+      -0.002982346712452072, -0.1018362598405457,
+      -0.003829636200350435, -0.1051516213840111};
+  
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.28973e-06,v[0]->getAreaOfZone(),1.e-11);
+  delete v[0];
+  delete pol1;
+  delete pol2;
+}
+
+void QuadraticPlanarInterpTest::checkNonRegression12()
+{
+  INTERP_KERNEL::QUADRATIC_PLANAR::setPrecision(1e-6);
+  INTERP_KERNEL::QUADRATIC_PLANAR::setArcDetectionPrecision(1e-7);
+  double coords1[]=
+    { -0.5032251558760915, -0.8716087994449138,
+      -0.4695268343089433, -0.8806382374805872,
+      -0.4695268343089433, -0.8570494123835835,
+      -0.4914307433275896, -0.8511802776536561,
+      -0.4869703691141082, -0.8783417525751493,
+      -0.4695268343089433, -0.8688438249320853,
+      -0.480865131947653, -0.8555566971861125,
+      -0.4973279496018406, -0.8613945385492849};
+
+  double coords2[]=
+    { -0.5065868681155701, -0.8774455199666568,
+      -0.4695187143958762, -0.8873779018223601,
+      -0.4695187143968347, -0.8806382375105907,
+      -0.5032170359605401, -0.8716087994611657,
+      -0.488706602695924, -0.8848517684025307,
+      -0.4695187143963554, -0.8840080696664754,
+      -0.4869622492144596, -0.8783417525850385,
+      -0.5049019520380551, -0.8745271597139112};
+
+  vector<Node *> nodes1;
+  nodes1.push_back(new Node(coords1));
+  nodes1.push_back(new Node(coords1+2));
+  nodes1.push_back(new Node(coords1+4));
+  nodes1.push_back(new Node(coords1+6));
+  nodes1.push_back(new Node(coords1+8));
+  nodes1.push_back(new Node(coords1+10));
+  nodes1.push_back(new Node(coords1+12));
+  nodes1.push_back(new Node(coords1+14));
+  QuadraticPolygon *pol1=QuadraticPolygon::buildArcCirclePolygon(nodes1);
+  vector<Node *> nodes2;
+  nodes2.push_back(new Node(coords2));
+  nodes2.push_back(new Node(coords2+2));
+  nodes2.push_back(new Node(coords2+4));
+  nodes2.push_back(new Node(coords2+6));
+  nodes2.push_back(new Node(coords2+8));
+  nodes2.push_back(new Node(coords2+10));
+  nodes2.push_back(new Node(coords2+12));
+  nodes2.push_back(new Node(coords2+14));
+  QuadraticPolygon *pol2=QuadraticPolygon::buildArcCirclePolygon(nodes2);
+  pol1->dumpInXfigFileWithOther(*pol2,"tutu.fig");// tony
+  vector<QuadraticPolygon *> v=pol1->intersectMySelfWith(*pol2);
+  CPPUNIT_ASSERT_EQUAL(1,(int)v.size());
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.28973e-06,v[0]->getAreaOfZone(),1.e-11);
+  delete v[0];
+  delete pol1;
+  delete pol2;
+}
index 1618714bb712eb0c653463bb9b37c0b4d9917492..e9827a1afc042a59de3fa801ca4856ace7ddbf8e 100644 (file)
@@ -29,6 +29,7 @@
 #include "RemapperTest.hxx"
 #include "MultiElement2DTests.hxx"
 #include "SingleElementPlanarTests.hxx"
+#include "QuadraticPlanarInterpTest.hxx"
 
 using namespace INTERP_TEST;
 
@@ -36,13 +37,14 @@ using namespace INTERP_TEST;
 CPPUNIT_TEST_SUITE_REGISTRATION( HexaTests );
 CPPUNIT_TEST_SUITE_REGISTRATION( MultiElementTetraTests );
 CPPUNIT_TEST_SUITE_REGISTRATION( SingleElementTetraTests );
-CPPUNIT_TEST_SUITE_REGISTRATION( INTERP_TEST::TransformedTriangleIntersectTest );
-CPPUNIT_TEST_SUITE_REGISTRATION( INTERP_TEST::TransformedTriangleTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( TransformedTriangleIntersectTest );
+CPPUNIT_TEST_SUITE_REGISTRATION( TransformedTriangleTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( BBTreeTest);
 CPPUNIT_TEST_SUITE_REGISTRATION( RemapperTest);
 CPPUNIT_TEST_SUITE_REGISTRATION( PointLocatorTest);
 CPPUNIT_TEST_SUITE_REGISTRATION( MultiElement2DTests );
 CPPUNIT_TEST_SUITE_REGISTRATION( SingleElementPlanarTests );
+CPPUNIT_TEST_SUITE_REGISTRATION( QuadraticPlanarInterpTest );
 
 // --- generic Main program from KERNEL_SRC/src/Basics/Test