Changeset 8560

Show
Ignore:
Timestamp:
07/11/08 18:51:11
Author:
robert
Message:

Updated KdTree? code to refect new cleaned up API

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OpenSceneGraph/trunk/src/osgUtil/LineSegmentIntersector.cpp

    r8552 r8560  
    302302    { 
    303303        osg::KdTree::LineSegmentIntersections intersections; 
     304        intersections.reserve(4); 
    304305        if (kdTree->intersect(s,e,intersections)) 
    305306        { 
     
    309310                ++itr) 
    310311            { 
    311                 osg::KdTree::LineSegmentIntersection& lsi = const_cast<osg::KdTree::LineSegmentIntersection&>(*itr); 
     312                osg::KdTree::LineSegmentIntersection& lsi = *(itr); 
    312313                 
    313314                // get ratio in s,e range 
     
    331332                hit.localIntersectionNormal = lsi.intersectionNormal; 
    332333                 
    333                 hit.indexList.swap(lsi.indexList); 
    334                 hit.ratioList.swap(lsi.ratioList); 
     334                hit.indexList.reserve(3); 
     335                hit.ratioList.reserve(3); 
     336                if (lsi.r0!=0.0f)  
     337                { 
     338                    hit.indexList.push_back(lsi.p0); 
     339                    hit.ratioList.push_back(lsi.r0); 
     340                } 
     341                 
     342                if (lsi.r1!=0.0f)  
     343                { 
     344                    hit.indexList.push_back(lsi.p1); 
     345                    hit.ratioList.push_back(lsi.r1); 
     346                } 
     347 
     348                if (lsi.r2!=0.0f)  
     349                { 
     350                    hit.indexList.push_back(lsi.p2); 
     351                    hit.ratioList.push_back(lsi.r2); 
     352                } 
    335353 
    336354                insertIntersection(hit); 
    337  
    338355            } 
    339356        }