void colorCloudSub(const sensor_msgs::PointCloud2ConstPtr &msg) { pcl::PointCloud<pcl::PointXYZRGB>::Ptr laser_cloud(new pcl::PointCloud<pcl::PointXYZRGB>); pcl::PCLPointCloud2 pcl_pc2; pcl_conversions::toPCL(*msg, pcl_pc2); pcl::fromPCLPointCloud2(pcl_pc2, *laser_cloud); addCloud(laser_cloud); }
void cData::addReplaceCloud(GlCloud *cloud, int id) { if(id < _Clouds.size()) _Clouds[id] = cloud; else addCloud(cloud); computeCenterAndBBox(id); }
/* 添加云 */ int ws__addCloud(WS_ENV* ws_env, xsd__int cloudType, xsd__string cloudName, xsd__string boardList, xsd__int hashInner, xsd__int hashOuter, xsd__int domain, xsd__int *ret) { *ret = addCloud(cloudType,cloudName,boardList,hashInner, hashOuter, domain); if (ERROR_SUCCESS != *ret) { return ws_send_soap_error(ws_env, bond_error_str(*ret)); } return WS_OK; }
void client::Vizualizer::addClouds(std::vector<client::PointCloud>& clouds, int mode, float alpha, float pointSize){ for(std::vector<client::PointCloud>::iterator it = clouds.begin(); it != clouds.end(); it++){ float r = (std::rand() % 100) / 100.0; float g = (std::rand() % 100) / 100.0; float b = (std::rand() % 100) / 100.0; addCloud(*it, mode, r, g, b, alpha, pointSize); } }
void Mesh2Cloud::sample(int samplesPerSquareUnit) { typedef MeshAnalysis<Traits> MA; execute( [&] () { MA::sampleOnSurface<Point>(*m_mesh, samplesPerSquareUnit, m_cloud); }, [&] () { gui()->log()->info("Sampling finished. Sampled "+lexical_cast<std::string>(m_cloud->size())+" points."); addCloud("Main Cloud", rgbaRed(), m_cloud); addNormals("Main Cloud Normals", rgbaWhite(), m_cloud, false); gui()->properties()->get<File>({"iogroup", "outFile"})->enable(); } ); //MA::sampleOnSurface<Point>(m_mesh, samplesPerSquareUnit, m_cloud); }
MultiPointCloud::MultiPointCloud(ModelPtr model, string name) { PointBufferPtr p_buffer = model->m_pointCloud; if(p_buffer) { vector<indexPair> pairs = p_buffer->getSubClouds(); vector<indexPair>::iterator it; int c(1); size_t n; coord3fArr points = model->m_pointCloud->getIndexedPointArray( n ); color3bArr colors = model->m_pointCloud->getIndexedPointColorArray( n ); for(it = pairs.begin(); it != pairs.end(); it ++) { indexPair p = *it; // Create new point cloud from scan PointCloud* pc = new PointCloud; for(size_t a = p.first; a <= p.second; a++) { if(colors) { pc->addPoint(points[a][0], points[a][1], points[a][2], colors[a][0], colors[a][1], colors[a][2]); } else { pc->addPoint(points[a][0], points[a][1], points[a][2], 255, 0, 0); } } stringstream ss; pc->updateDisplayLists(); pc->setName(ss.str()); addCloud(pc); c++; } } m_model = model; }
boost::shared_ptr<PointCloud> CloudList::loadFile(QString filename) { if(!QFileInfo(filename).exists()) return nullptr; boost::shared_ptr<PointCloud> pc; pc.reset(new PointCloud()); pc->moveToThread(QApplication::instance()->thread()); connect(pc.get(), SIGNAL(progress(int)), this, SIGNAL(progressUpdate(int))); pc->load_ptx(filename.toLocal8Bit().constData()); emit progressUpdate(0); disconnect(pc.get(), SIGNAL(progress(int)), this, SIGNAL(progressUpdate(int))); emit startNonDetJob(); addCloud(pc); emit endNonDetJob(); emit listModified(); return pc; }
//cloud creation void Clouds::updateScene(float passedSeconds, float totalPassedTime) { // move the spheres for (size_t i = 0; i < offsets.size(); i++) { // translate the offset of all spheres // - floats at same speed no matter which FPS offsets.at(i) += expansionDirection * FLOATING_SPEED_PER_SECOND * passedSeconds; // remove if it is out of view (2D cloud offset > radius of cloud plane circle) float offsetLength = glm::length(glm::vec2(offsets.at(i).x, offsets.at(i).z)); bool invisible = offsetLength > SKYBOX_LENGTH * 1.4; // add 40% to avoid removing clouds that have just been spawned if (invisible) { offsets.erase(offsets.begin() + i); noises.erase(noises.begin() + i); scales.erase(scales.begin() + i); i--; } } // add new spheres if (offsets.size() < NUMBER_OF_SPHERES - SPHERES_PER_CLOUD/* && currentFrameRate > MIN_FRAME_RATE*/) { int numberOfAdditionalClouds = (NUMBER_OF_SPHERES - offsets.size()) / SPHERES_PER_CLOUD; for (size_t i = 0; i < numberOfAdditionalClouds; i++) { float randDecision = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); if ((totalPassedTime - lastCloudCreated > MIN_CLOUD_CREATION_DISTANCE_SECONDS && randDecision < SPAWN_CLOUD_LIKELYHOOD) || offsets.size() == 0) { addCloud(SPHERES_PER_CLOUD); lastCloudCreated = totalPassedTime; } } } }
void GameScene::update( float dt ) { addBarrier(); addCloud(); position = character->getPosition(); if(gameState == 1) { dy = position.y + speed.y - visibleSize.height/2; if(dy > 0 && speed.y > 0) { bottomSprite->setPosition(bottomSprite->getPositionX(),bottomSprite->getPositionY()-dy); forestSprite->setPosition(forestSprite->getPositionX(),forestSprite->getPositionY()-dy); for(int i=0; i<barriers.size(); i++) { if(barriers.at(i)->isVisible()) { barriers.at(i)->setPositionY(barriers.at(i)->getPositionY()-dy); } else { delete barriers.at(i); barriers.erase(barriers.begin()+i); barrier++; } } for(int i=0; i<clouds.size(); i++) { if(clouds.at(i)->isVisible()) { clouds.at(i)->setPosition(Vect(clouds.at(i)->getPosition().x,clouds.at(i)->getPosition().y-dy)); } else { delete clouds.at(i); clouds.erase(clouds.begin()+i); } } if(position.x + speed.x > visibleSize.width) { character->setPosition(Vect(visibleSize.width,visibleSize.height/2)); } else if(position.x + speed.x < 0) { character->setPosition(Vect(0,visibleSize.height/2)); } else { character->setPosition(Vect(position.x+speed.x,visibleSize.height/2)); } } else { if(position.y + speed.y < character->getSize().height / 2 + bottomSprite->getPositionY() + bottomSprite->getContentSize().height / 2) { speed.x = 0; speed.y = 0; character->setPosition(Vect(position.x,character->getSize().height / 2 + bottomSprite->getPositionY() + bottomSprite->getContentSize().height / 2)); } else { if(position.x + speed.x > visibleSize.width) { character->setPosition(Vect(visibleSize.width,position.y+speed.y)); } else if(position.x + speed.x < 0) { character->setPosition(Vect(0,position.y+speed.y)); } else { character->setPosition(Vect(position.x+speed.x,position.y+speed.y)); } } } if(position.y - character->getSize().height / 2 < 0) { GameOver(); } if(position.y > barriers.at(score-barrier)->getPositionY()) { addScore(); } speed.y = speed.y - 1; } else if(gameState == 2) { if(position.y - character->getSize().height / 2 < 0) { GameOver(); } character->setPosition(Vect(position.x,position.y+speed.y)); speed.y = speed.y - 1; } }
boost::shared_ptr<PointCloud> CloudList::addCloud(const char* filename) { boost::shared_ptr<PointCloud> pc(new PointCloud()); pc->load_ptx(filename); return addCloud(pc); }
boost::shared_ptr<PointCloud> CloudList::addCloud() { boost::shared_ptr<PointCloud> pc(new PointCloud()); return addCloud(pc); }
void cv::viz::WCloudCollection::addCloud(InputArray cloud, const Color &color, const Affine3d &pose) { addCloud(cloud, Mat(cloud.size(), CV_8UC3, color), pose); }