- // TODO: mark triangles with nodes on VERTEXes to
- // less frequently compare with avoidPnt in GetMinDistInSphere()
- //
- // Handle(Poly_PolygonOnTriangulation) polygon =
- // BRep_Tool::PolygonOnTriangulation( edge, tr, loc );
- // if ( polygon.IsNull() /*|| !pologon.HasParameters()*/ )
- // continue;
- // Handle(TColStd_Array1OfInteger) nodeIDs = polygon->Nodes();
+ // fill mySegments by boundary links
+ mySegments.resize( linkToSegMap.size() );
+ int iS = 0;
+ for ( l2s = linkToSegMap.begin(); l2s != linkToSegMap.end(); ++l2s, ++iS )
+ {
+ const NLink& link = (*l2s).first;
+ (*l2s).second = & mySegments[ iS ];
+ mySegments[ iS ].Init( myNodes( link.N1() ),
+ myNodes( link.N2() ));
+ }
+ }
+
+ // initialize myTrias
+ myTrias.resize( tr->NbTriangles() );
+ Standard_Integer n1,n2,n3;
+ for ( int i = 1; i <= tr->NbTriangles(); ++i )
+ {
+ Triangle & t = myTrias[ i-1 ];
+ tr->Triangle( i ).Get( n1,n2,n3 );
+ t.Init( myNodes.Value( n1 ),
+ myNodes.Value( n2 ),
+ myNodes.Value( n3 ));
+ int nbSeg = 0;
+ if (( l2s = linkToSegMap.find( NLink( n1, n2 ))) != linkToSegMap.end())
+ t.mySegments[ nbSeg++ ] = l2s->second;
+ if (( l2s = linkToSegMap.find( NLink( n2, n3 ))) != linkToSegMap.end())
+ t.mySegments[ nbSeg++ ] = l2s->second;
+ if (( l2s = linkToSegMap.find( NLink( n3, n1 ))) != linkToSegMap.end())
+ t.mySegments[ nbSeg++ ] = l2s->second;
+ while ( nbSeg < 3 )
+ t.mySegments[ nbSeg++ ] = NULL;
+
+ t.myIsChecked = false;
+ t.myHasNodeOnVertex = ( vertexNodes.count( n1 ) ||
+ vertexNodes.count( n2 ) ||
+ vertexNodes.count( n3 ));