What I want to do is to change the visibility of each cloudpoints according its classification. But if I try to change the visibility of cloudpoint whose classification is 1(I think 1 represent Vegetation), then those cloudpoints whose classification is 2(Groud) would change their classifications to 1.
It is defficult to me to describe this phenomenon, and I am not sure whether you have understood my situation, so I would show you some pictures to explain my problem.
this is original situation, and after I run those codes, a strange thing would happen.
Code: Select all
CCLib::ScalarField* pClassification = cloud->getScalarField(0);
ccGenericPointCloud::VisibilityTableType* visibilityArray = cloud->getTheVisibilityArray();
unsigned cloudSize = cloud->size();
for (int i = 0; i < static_cast<int>(cloudSize); ++i)
{
int state = pClassification->getValue(i);
if (1 == state) {
visibilityArray->setValue(i, POINT_HIDDEN);
}
}
So what I expect is those blue points should dispear. However the fact is those blue point become green and some points dispear, which is totally werid to me. What's more, if I change the number "1" to other numbers like "2" or "6", it would let those points whose classification is "2"(or "6") dispear.
I am sure there is no any codes trying to change the classification of cloudpoints. So how to solve this bug?