void CloudEditorWidget::loadFilePCD(const std::string &filename) { PclCloudPtr pcl_cloud_ptr; Cloud3D tmp; if (pcl::io::loadPCDFile<Point3D>(filename, tmp) == -1) throw; pcl_cloud_ptr = PclCloudPtr(new Cloud3D(tmp)); std::vector<int> index; pcl::removeNaNFromPointCloud(*pcl_cloud_ptr, *pcl_cloud_ptr, index); Statistics::clear(); cloud_ptr_ = CloudPtr(new Cloud(*pcl_cloud_ptr, true)); selection_ptr_ = SelectionPtr(new Selection(cloud_ptr_, true)); copy_buffer_ptr_ = CopyBufferPtr(new CopyBuffer(true)); cloud_ptr_->setPointSize(point_size_); cloud_ptr_->setHighlightPointSize(selected_point_size_); tool_ptr_ = boost::shared_ptr<CloudTransformTool>(new CloudTransformTool(cloud_ptr_)); if (isColored(filename)) { swapRBValues(); color_scheme_ = COLOR_BY_RGB; is_colored_ = true; } else { color_scheme_ = COLOR_BY_Z; is_colored_ = false; } }
Solution updateGreedyNodes(GreedyState* state, Node** nodeArray, Color* colorTest, set<Node*, greaterNode> twoOptionNodes, set<Node*, greaterNode> threeOptionNodes) { for (unsigned int cntr = 0; cntr < state->nodesUpdated.size(); cntr++) { int updated = state->nodesUpdated[cntr]; Color updatedColor = colorTest[updated]; // compute coloring implications and record any change we made for the coloring attempt set<int>::iterator iter = nodeArray[updated]->getVertices(); while (iter != nodeArray[updated]->getVerticesEnd()) { int effected = *iter; iter++; if (isColored(colorTest[effected])) { if (colorTest[effected] == updatedColor) { // We have a collision, time to unwind and try again. DEBUG("Got a color(%d) collision between nodes %s and %s.", updatedColor, nodeArray[updated]->getName().c_str(), nodeArray[effected]->getName().c_str()); return NOT_COLORABLE; } continue; } Color before = colorTest[effected]; Color after = (Color)(before | negativeColor(updatedColor)); if (after == IMPOSSIBLE) { // TODO: Add clean up code. DEBUG("Got an impossible on node %s.", nodeArray[effected]->getName().c_str()); return NOT_COLORABLE; } after = impliedColor(after); setNodeInOptionSet(twoOptionNodes, threeOptionNodes, nodeArray[effected], before, after); colorTest[effected] = after; if (isColored(after)) { // We just pushed a new node to colored so we need handle all of its subsidiary nodes. state->nodesUpdated.push_back(effected); } state->revertMap[effected] = before; } } return UNKNOWN_SOLUTION; }
bool VoxelTreeElement::requiresSplit() const { return isLeaf() && isColored(); }