other.getAllNodes(allNodes);
for(std::set<Node *>::iterator iter=allNodes.begin();iter!=allNodes.end();iter++)
(*iter)->unApplySimilarity(xBary,yBary,fact);
+
+ // [Adrien] - same issue as in applyGlobalSimilarity() - see comments there
+ std::set<Edge *> allEdges;
for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
- (*iter)->unApplySimilarity(xBary,yBary,fact);
+ allEdges.insert((*iter)->getPtr());
for(std::list<ElementaryEdge *>::iterator iter=other._sub_edges.begin();iter!=other._sub_edges.end();iter++)
+ allEdges.insert((*iter)->getPtr());
+ for(std::set<Edge *>::iterator iter = allEdges.begin();iter != allEdges.end();iter++)
(*iter)->unApplySimilarity(xBary,yBary,fact);
}
allNodes.insert(allNodes2.begin(),allNodes2.end());
for(std::set<Node *>::iterator iter=allNodes.begin();iter!=allNodes.end();iter++)
(*iter)->applySimilarity(xBary,yBary,dimChar);
+ // [Adrien] many ElementaryEdge might reference the same Edge* - ensure we don'y scale twice!
+ std::set<Edge *> allEdges;
for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
- (*iter)->applySimilarity(xBary,yBary,dimChar);
+ allEdges.insert((*iter)->getPtr());
for(std::list<ElementaryEdge *>::iterator iter=other->_sub_edges.begin();iter!=other->_sub_edges.end();iter++)
- (*iter)->applySimilarity(xBary,yBary,dimChar);
+ allEdges.insert((*iter)->getPtr());
+ // Similarity only on set of unique underlying edges:
+ for(std::set<Edge *>::iterator iter = allEdges.begin();iter != allEdges.end();iter++)
+ (*iter)->applySimilarity(xBary,yBary,dimChar);
}
/*!
{
Bounds b; b.prepareForAggregation();
fillBounds(b);
- if(b.nearlyWhere((*nodeToTest)[0],(*nodeToTest)[1])==OUT)
- return false;
+ //if(b.nearlyWhere((*nodeToTest)[0],(*nodeToTest)[1])==OUT)
+ // return false;
// searching for e1
std::set<Node *> nodes;
getAllNodes(nodes);
Edge *e=val->getPtr();
std::auto_ptr<EdgeIntersector> intersc(Edge::BuildIntersectorWith(e1,e));
bool obviousNoIntersection,areOverlapped;
- intersc->areOverlappedOrOnlyColinears(0,obviousNoIntersection,areOverlapped);
+ intersc->areOverlappedOrOnlyColinears(0,obviousNoIntersection,areOverlapped); // first parameter never used
if(obviousNoIntersection)
{
continue;
void ArcCSegIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped)
{
- areOverlapped=false;//No overlapping by contruction
+ areOverlapped=false;//No overlapping by construction
const double *center=getE1().getCenter();
_dx=(*(_e2.getEndNode()))[0]-(*(_e2.getStartNode()))[0];
_dy=(*(_e2.getEndNode()))[1]-(*(_e2.getStartNode()))[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.
+ * Here in [0; Pi). 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)
}
}
-
void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad,
const int *nodalBg, const double *coords,
const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
//
CPPUNIT_TEST( checkNormalize );
CPPUNIT_TEST( checkMakePartitionAbs1 );
+ //
+ CPPUNIT_TEST( checkIsInOrOut );
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
//
void checkNormalize();
void checkMakePartitionAbs1();
+ // From Adrien:
+ void checkIsInOrOut();
+
private:
INTERP_KERNEL::QuadraticPolygon *buildQuadraticPolygonCoarseInfo(const double *coords, const int *conn, int lgth);
INTERP_KERNEL::EdgeArcCircle *buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd);
delete pol2;
}
+void QuadraticPlanarInterpTest::checkIsInOrOut()
+{
+ double coords[8]={ 0.30662641093707971, -0.47819928619088981,
+ -0.47819928619088964, 0.30662641093707987,
+ 0.0, 0.0,
+ 0.4, 0.4
+ };
+ coords[4] = (coords[0] + coords[2]) / 2.0;
+ coords[5] = (coords[1] + coords[3]) / 2.0;
+
+/* double r = 0.55495557248864675969;
+ coords[6] = coords[4];
+ coords[7] = coords[5] + r;*/
+
+ int tab4[4]={ 0, 1, 2, 3};
+ QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab4,4);
+ Node * n = new Node(0.3175267678416348, -0.4890996430954449);
+
+ CPPUNIT_ASSERT(! pol1->isInOrOut(n)); // node should be out
+ delete pol1;
+}
+
+
}
INTERP_KERNEL::QuadraticPolygon pol1;
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]];
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
+ // Populate mapp and mappRev with nodes from the current cell (i) from mesh1 - this also builds the Node* objects:
MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,/* output */mapp,mappRev);
// pol1 is the full cell from mesh2, in QP format, with all the additional intersecting nodes.
pol1.buildFromCrudeDataArray(mappRev,cm.isQuadratic(),conn1+connI1[i]+1,coo1,
{
INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]];
const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2);
+ // Complete mapping with elements coming from the current cell it2 in mesh2:
MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */mapp,mappRev);
// pol2 is the new QP in the final merged result.
pol2s[ii].buildFromCrudeDataArray2(mappRev,cm2.isQuadratic(),conn2+connI2[*it2]+1,coo2,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,
- pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2,edgesIn2ForShare);
+ pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2, /* output */ edgesIn2ForShare);
}
ii=0;
for(std::vector<int>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)