+ INTERSECTOR_TEMPLATE
+ double GEO2D_INTERSECTOR::intersectGeometryGeneral(const std::vector<double>& targetCoords,
+ const std::vector<double>& sourceCoords)
+ {
+ int nbOfTargetNodes=targetCoords.size()/SPACEDIM;
+ std::vector<Node *> nodes(nbOfTargetNodes);
+ for(int i=0;i<nbOfTargetNodes;i++)
+ nodes[i]=new Node(targetCoords[i*SPACEDIM],targetCoords[i*SPACEDIM+1]);
+ int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ std::vector<Node *> nodes2(nbOfSourceNodes);
+ for(int i=0;i<nbOfSourceNodes;i++)
+ nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
+ QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
+ QuadraticPolygon *p2=QuadraticPolygon::BuildLinearPolygon(nodes2);
+ double ret=p1->intersectWithAbs(*p2);
+ delete p1; delete p2;
+ return ret;
+ }
+
+ //================================================================================
+ /*!
+ * \brief Intersect a triangle and a polygon for P1P0 barycentric algorithm
+ * \param targetCell - list of coordinates of target polygon in full interlace
+ * \param targetCellQuadratic - specifies if target polygon is quadratic or not
+ * \param sourceTria - list of coordinates of source triangle
+ * \param res - coefficients a,b and c associated to nodes of sourceTria
+ */
+ //================================================================================
+
+ INTERSECTOR_TEMPLATE
+ double GEO2D_INTERSECTOR::intersectGeoBary(const std::vector<double>& targetCell,
+ bool targetCellQuadratic,
+ const double * sourceTria,
+ std::vector<double>& res)
+ {
+ std::vector<Node *> nodes(3);
+ nodes[0]=new Node(sourceTria[0*SPACEDIM],sourceTria[0*SPACEDIM+1]);
+ nodes[1]=new Node(sourceTria[1*SPACEDIM],sourceTria[1*SPACEDIM+1]);
+ nodes[2]=new Node(sourceTria[2*SPACEDIM],sourceTria[2*SPACEDIM+1]);
+ int nbOfTargetNodes=targetCell.size()/SPACEDIM;
+ std::vector<Node *> nodes2(nbOfTargetNodes);
+ for(int i=0;i<nbOfTargetNodes;i++)
+ nodes2[i]=new Node(targetCell[i*SPACEDIM],targetCell[i*SPACEDIM+1]);
+ QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
+ QuadraticPolygon *p2;
+ if(!targetCellQuadratic)
+ p2=QuadraticPolygon::BuildLinearPolygon(nodes2);
+ else
+ p2=QuadraticPolygon::BuildArcCirclePolygon(nodes2);
+ double barycenter[2];
+ double ret=p1->intersectWithAbs(*p2,barycenter);
+ delete p1; delete p2;
+ if ( ret > std::numeric_limits<double>::min() )
+ {
+ std::vector<const double* > sourceCell(3);
+ sourceCell[0] = &sourceTria[0];
+ sourceCell[1] = &sourceTria[SPACEDIM];
+ sourceCell[2] = &sourceTria[SPACEDIM*2];
+ res.resize(3);
+ barycentric_coords( sourceCell, barycenter, &res[0]);
+ res[0] *= ret;
+ res[1] *= ret;
+ res[2] *= ret;
+ }
+ else
+ {
+ ret = 0;
+ }
+ return ret;
+ }
+
+ INTERSECTOR_TEMPLATE
+ QuadraticPolygon *GEO2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)