-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
}
else if ( NbNodes() > 0 )
{
+ size_t nbFoundBefore = dist2Nodes.size();
double minDist = precision * precision;
gp_Pnt p1 ( node.X(), node.Y(), node.Z() );
TIDSortedNodeSet::iterator nIt = myNodes.begin();
// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
- return ( sqrt( minDist) <= precision * 1e-12 );
+ return ( nbFoundBefore < dist2Nodes.size() );
}
}
return false;
* \param precision - Precision used
*/
//======================================================================================
-void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
- TIDSortedNodeSet* SetOfNodes,
+void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
+ TIDSortedNodeSet* SetOfNodes,
list<const SMDS_MeshNode*>* Result,
- const double precision)
+ const double precision)
{
- gp_XYZ p(Node->X(), Node->Y(), Node->Z());
- bool isInsideBool = isInside(p, precision);
+ gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
+ bool isInsideBool = isInside( p1.XYZ(), precision );
if (isInsideBool)
{
// I'm only looking in the leaves, since all the nodes are stored there.
if (isLeaf())
{
- gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
-
- TIDSortedNodeSet myNodesCopy = myNodes;
- TIDSortedNodeSet::iterator it = myNodesCopy.begin();
- double tol2 = precision * precision;
+ TIDSortedNodeSet::iterator it = myNodes.begin();
+ const double tol2 = precision * precision;
bool squareBool;
- while (it != myNodesCopy.end())
+ while (it != myNodes.end())
{
const SMDS_MeshNode* n2 = *it;
+ squareBool = false;
// We're only looking at nodes with a superior Id.
// JFA: Why?
//if (Node->GetID() < n2->GetID())
{
Result->insert(Result->begin(), n2);
SetOfNodes->erase( n2 );
- myNodes.erase( n2 );
+ myNodes.erase( *it++ ); // it++ goes forward and returns it's previous position
}
}
- //myNodesCopy.erase( it );
- //it = myNodesCopy.begin();
- it++;
+ if ( !squareBool )
+ it++;
}
- if (Result->size() > 0)
+ if ( !Result->empty() )
myNodes.erase(Node); // JFA: for bug 0020185
}
else