But it always crush.
Code: Select all
for( int i=0; i<cloud->size(); i++)
{
ccColor::Rgb color; //same color for example
color.r = 255;
color.g = 0;
color.b = 0;
cloud->setPointColor(i, color); // this line always crush.
}
Code: Select all
for( int i=0; i<cloud->size(); i++)
{
ccColor::Rgb color; //same color for example
color.r = 255;
color.g = 0;
color.b = 0;
cloud->setPointColor(i, color); // this line always crush.
}
Code: Select all
BinFilter bin;
BinFilter::LoadParameters lp;
BinFilter::SaveParameters sp;
ccHObject *obj = new ccHObject;
bin.loadFile("origin_cloud.bin", *obj, lp);
ccPointCloud *cloud = ccHObjectCaster::ToPointCloud(obj->getFirstChild());
if (cloud->resizeTheRGBTable(true))
{
for (int i = 0; cloud->size(); i++)
{
ccColor::Rgb color;
color.r = 255;
color.g = 0;
color.b = 0;
cloud->setPointColor(i, color); // <- crush in this line.
}
bin.saveToFile(cloud, "cloud_color.bin", sp);
}
erminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check: __n (which is 36595) >= this->size() (which is 36595)