- Timestamp:
- 11/19/09 12:16:58 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgUtil/DelaunayTriangulator.cpp
r10764 r10777 614 614 } 615 615 616 template <typename TVector> 617 void removeIndices( TVector& elements, unsigned int index ) 618 { 619 typename TVector::iterator itr = elements.begin(); 620 while ( itr != elements.end() ) 621 { 622 if ( (*itr)==index ) 623 { // remove entirely 624 itr = elements.erase(itr); 625 } 626 else 627 { 628 if ((*itr)>index) --(*itr); // move indices down 1 629 ++itr; // next index 630 } 631 } 632 } 633 616 634 void DelaunayConstraint::removeVerticesInside(const DelaunayConstraint *dco) 617 635 { /** remove vertices from this which are internal to dco. … … 632 650 { 633 651 osg::PrimitiveSet* prset=getPrimitiveSet(ipr); 634 osg::DrawElementsUShort *dsup=dynamic_cast<osg::DrawElementsUShort *>(prset); 635 if (dsup) { 636 for (osg::DrawElementsUShort::iterator usitr=dsup->begin(); usitr!=dsup->end(); ) 637 { 638 if ((*usitr)==idx) 639 { // remove entirely 640 usitr=dsup->erase(usitr); 641 } 642 else 643 { 644 if ((*usitr)>idx) (*usitr)--; // move indices down 1 645 usitr++; // next index 646 } 647 } 648 } 649 else 652 switch (prset->getType()) 650 653 { 654 case osg::PrimitiveSet::DrawElementsUBytePrimitiveType: 655 removeIndices( *static_cast<osg::DrawElementsUByte *>(prset), idx ); 656 break; 657 case osg::PrimitiveSet::DrawElementsUShortPrimitiveType: 658 removeIndices( *static_cast<osg::DrawElementsUShort *>(prset), idx ); 659 break; 660 case osg::PrimitiveSet::DrawElementsUIntPrimitiveType: 661 removeIndices( *static_cast<osg::DrawElementsUInt *>(prset), idx ); 662 break; 663 default: 651 664 osg::notify(osg::WARN) << "Invalid prset " <<ipr<< " tp " << prset->getType() << " types PrimitiveType,DrawArraysPrimitiveType=1 etc" << std::endl; 665 break; 652 666 } 653 667 } … … 1038 1052 if (!tradj->usesVertex(ip2)) osg::notify(osg::WARN) << "tradj error " << tradj->a()<< " , " << tradj->b()<< " , " << tradj->c()<< std::endl; 1039 1053 } 1054 const Triangle *previousTradj = tradj; 1040 1055 tradj=getTriangleWithEdge(e2,e1, &triangles); 1056 if (tradj == previousTradj) { 1057 tradj = 0; 1058 } 1041 1059 } 1042 1060 if (trisToDelete.size()>=900) {
