[CC]获取ScalarField的值

//根据字段滤波
void MainWindow::doActionFilterByValue()

 1 ReferenceCloud* ManualSegmentationTools::segment(GenericIndexedCloudPersist* aCloud, ScalarType minDist, ScalarType maxDist)
 2 {
 3     if (!aCloud)
 4     {
 5         assert(false);
 6         return 0;
 7     }
 8 
 9     ReferenceCloud* Y = new ReferenceCloud(aCloud);
10 
11     //for each point
12     for (unsigned i=0; i<aCloud->size(); ++i)
13     {
14         const ScalarType dist = aCloud->getPointScalarValue(i);
15         //we test if its assocaited scalar value falls inside the specified intervale
16         if (dist >= minDist && dist <= maxDist)
17         {
18             if (!Y->addPointIndex(i))
19             {
20                 //not engouh memory
21                 delete Y;
22                 Y=0;
23                 break;
24             }
25         }
26     }
27 
28     return Y;
29 }

 

posted @ 2016-12-02 16:54  太一吾鱼水  阅读(470)  评论(0编辑  收藏  举报