-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 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
/*!
* \brief Constructor
*/
- SMESH_NodeSearcherImpl( const SMDS_Mesh* theMesh )
+ SMESH_NodeSearcherImpl( const SMDS_Mesh* theMesh = 0,
+ SMDS_ElemIteratorPtr theElemIt = SMDS_ElemIteratorPtr() )
{
myMesh = ( SMDS_Mesh* ) theMesh;
while ( nIt->more() )
nodes.insert( nodes.end(), nIt->next() );
}
+ else if ( theElemIt )
+ {
+ while ( theElemIt->more() )
+ {
+ const SMDS_MeshElement* e = theElemIt->next();
+ nodes.insert( e->begin_nodes(), e->end_nodes() );
+ }
+ }
myOctreeNode = new SMESH_OctreeNode(nodes) ;
// get max size of a leaf box
{
GC_MakeSegment edge( SMESH_TNodeXYZ( face->GetNode( i )),
SMESH_TNodeXYZ( face->GetNode( (i+1)%nbNodes) ));
- anExtCC.Init( lineCurve, edge);
+ anExtCC.Init( lineCurve, edge.Value() );
if ( anExtCC.NbExtrema() > 0 && anExtCC.LowerDistance() <= tol)
{
Quantity_Parameter pl, pe;
if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement || type == SMDSAbs_Ball)
{
if ( !_nodeSearcher )
- _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
-
+ {
+ if ( _meshPartIt )
+ _nodeSearcher = new SMESH_NodeSearcherImpl( 0, _meshPartIt );
+ else
+ _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
+ }
std::vector< const SMDS_MeshNode* > foundNodes;
_nodeSearcher->FindNearPoint( point, tolerance, foundNodes );
dist.back() = dist.front();
// find the closest intersection
int iClosest = -1;
- double rClosest, distClosest = 1e100;;
+ double rClosest = 0, distClosest = 1e100;;
gp_Pnt pClosest;
for ( i = 0; i < nbNodes; ++i )
{
// Node or 0D element -------------------------------------------------------------------------
{
gp_Vec n2p ( xyz[0], point );
- return n2p.SquareMagnitude() <= tol * tol;
+ return n2p.SquareMagnitude() > tol * tol;
}
return true;
}
return new SMESH_NodeSearcherImpl( &mesh );
}
+//=======================================================================
+/*!
+ * \brief Return SMESH_NodeSearcher
+ */
+//=======================================================================
+
+SMESH_NodeSearcher* SMESH_MeshAlgos::GetNodeSearcher(SMDS_ElemIteratorPtr elemIt)
+{
+ return new SMESH_NodeSearcherImpl( 0, elemIt );
+}
+
//=======================================================================
/*!
* \brief Return SMESH_ElementSearcher