This is my code, is it anything wrong?
My cloudcompare version is 2.9.1
If you can, please give me a resolution for it. Thanks.
Code: Select all
ccPointCloud *cc_cloud = new ccPointCloud;
cc_cloud->reserve(100);
for (int i = 0; i < 100; i++)
{
CCvecotr3 p;
p.x = i;
p.y = i;
p.z = i;
cc_cloud->addPoint(p);
}
cc_cloud->enableScalarField();
cc_cloud->showColors(true);
if (cc_cloud->resizeTheRGBTable(true))
{
srand(static_cast<unsigned int>(time(0)));
std::vector<unsigned char> colors;
for (size_t i = 0; i < cc_cloud->size(); i++)
{
colors.push_back(static_cast<unsigned char>(rand() % 256));
colors.push_back(static_cast<unsigned char>(rand() % 256));
colors.push_back(static_cast<unsigned char>(rand() % 256));
}
int next_color = 0;
for (int i = 0; i < cc_cloud->size(); i++)
{
ccColor::Rgb rgb = ccColor::Rgb(colors[3 * next_color], colors[3 * next_color + 1], colors[3 * next_color + 2]);
cc_cloud->setPointColor(i, rgb);
next_color++;
}
}
it can build sucessly, but always gets pointcloud without color.