Create a new point cloud
Posted: Sat May 05, 2018 12:35 am
Hi, I have integrates an interface that I have developed with CloudCompare. So, in my interface, I have stereo-images and I use them to get 3D coordinates of any point. I want to know if there's any way I can create a new point cloud consisting this point and display it in CC as a new point cloud? Something like how the points are displayed on using "Point List Picking" tool, except that the points are totally new and do not belong to any already displayed point cloud.
Could you maybe point me in the right direction for which function in CC actually handles the highlighting of a point? I am providing a snippet of my code which is able to create labels for any clicked point with its 3D coordinates. This just creates the labels. I am unable to set a position on the screen for them because for that, I need to know where the 3D coordinates would appear among the already existing point clouds. How do I proceed further?
Could you maybe point me in the right direction for which function in CC actually handles the highlighting of a point? I am providing a snippet of my code which is able to create labels for any clicked point with its 3D coordinates. This just creates the labels. I am unable to set a position on the screen for them because for that, I need to know where the 3D coordinates would appear among the already existing point clouds. How do I proceed further?
Code: Select all
void displayIntersectedPointInCC(Vector3d point)
{
if (!cloudCreated)
{
cloud = new ccPointCloud();
cloudCreated = true;
}
int count = intersectedObjectPoints.size();
if (cloud->reserve(count))
{
cloud->setName("Intersected Points");
cloud->setDisplay(associatedCloud->getDisplay());
cloud->setGlobalShift(associatedCloud->getGlobalShift());
cloud->setGlobalScale(associatedCloud->getGlobalScale());
const CCVector3* P = new CCVector3{ static_cast<float>(point[0]), static_cast<float>(point[1]), static_cast<float>(point[2]) };
cloud->addPoint(*P);
MainWindow::TheInstance()->addToDB(cloud);
if (!intersectedPointsContainerCreated)
{
intersectedPointsContainerCreated = true;
intersectedPointsContainer = new ccHObject("Intersected Points");
cloud->addChild(intersectedPointsContainer);
intersectedPointsContainer->setDisplay(cloud->getDisplay());
MainWindow::TheInstance()->addToDB(intersectedPointsContainer, false, true, false, false);
}
intersectedPointsContainer->a
cc2DLabel* newLabel = new cc2DLabel();
newLabel->addPoint(cloud, 0);
newLabel->setVisible(true);
newLabel->setDisplayedIn2D(false);
newLabel->displayPointLegend(true);
newLabel->setCollapsed(false);
newLabel->setDisplay(cloud->getDisplay());
assert(intersectedPointsContainer);
intersectedPointsContainer->addChild(newLabel);
MainWindow::TheInstance()->addToDB(newLabel, false, true, false, false);
}
}