当前位置: 首页>>代码示例>>C++>>正文


C++ Floor::set_area方法代码示例

本文整理汇总了C++中Floor::set_area方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::set_area方法的具体用法?C++ Floor::set_area怎么用?C++ Floor::set_area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Floor的用法示例。


在下文中一共展示了Floor::set_area方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: process_request

void Controller::process_request(){
	if(this->_property_manager->_flag_requests[PropertyManager::R_FLOOR_AREA]){
		if(this->_aux_points->size() > 2){
			Floor *floor = new Floor();
			floor->set_area(this->_aux_points);

			this->add_floor(floor);

			this->_gui->update_floor_manager();
		}
		this->_property_manager->_flag_requests[PropertyManager::R_FLOOR_AREA] = false;
	}
	
	if(this->_property_manager->_flag_requests[PropertyManager::R_FLOOR_POINTS]){
		double a,b,c,d;
		//if(this->_kinect->get_floor_plane(&a,&b,&c,&d)){
		//	printf("%f, %f, %f, %f\n",a,b,c,d);

		//	this->_floor->set_plane(a,b,c,d);

		//	this->_property_manager->_flag_processed[PropertyManager::P_FLOOR_PLANE] = true;

		//	//cv::destroyWindow("Add Floor");
		//}
		//else{
			if(this->_aux_points->size() > 2){
				std::vector<cv::Point3f*> points3d;
				XnPoint3D *points_in = (XnPoint3D*)malloc(sizeof(XnPoint3D) * _aux_points->size());
				XnPoint3D *points_out = (XnPoint3D*)malloc(sizeof(XnPoint3D) * _aux_points->size());
				UINT16* ptr_16u = (UINT16*)this->_mat_depth16UC1.data;
				for(int i = 0 ; i < _aux_points->size() ; ++i){
					points_in[i].X = _aux_points->at(i)->x;
					points_in[i].Y = _aux_points->at(i)->y;
					points_in[i].Z = ptr_16u[((int)points_in[i].Y) * XN_VGA_X_RES + ((int)points_in[i].X)]; 
				}

				if(! this->_kinect->convert_to_realworld(_aux_points->size(),points_in,points_out)){
					this->_property_manager->_flag_processed[PropertyManager::P_FLOOR_PLANE] = false;
					
				}
				else{
					for(int i = 0 ; i < _aux_points->size() ; ++i){
						points3d.push_back(new cv::Point3f(points_out[i].X,points_out[i].Y,points_out[i].Z));
					}
				
					ToolBoxPCL::calc_plane_from_points(&points3d,&a,&b,&c,&d,1);

					this->_floor->set_plane(a,b,c,d);
					
					this->_gui->update_floor_manager();

					this->_property_manager->_flag_processed[PropertyManager::P_FLOOR_PLANE] = true;
				}
			}
			else{
				this->_property_manager->_flag_processed[PropertyManager::P_FLOOR_PLANE] = false;
			}
		//}

		this->_property_manager->_flag_requests[PropertyManager::R_FLOOR_POINTS] = false;
	}

	if(this->_property_manager->_flag_requests[PropertyManager::R_MIRROR_AREA]){
		if(this->_aux_points->size() > 2){
			Mirror *mirror = new Mirror();

			mirror->set_area(this->_aux_points);

			this->add_mirror(mirror);

			this->_gui->update_mirror_manager();
			//this->_gui->point_selection(3);
		}
		this->_property_manager->_flag_requests[PropertyManager::R_MIRROR_AREA] = false;
	}
	
	if(this->_property_manager->_flag_requests[PropertyManager::R_MIRROR_POINTS]){
		if(this->_aux_points->size() > 2){
			Mirror *mirror = this->_mirrors[this->_mirrors.size()-1];

			std::vector<cv::Point3f*> points3d;
			XnPoint3D *points_in = (XnPoint3D*)malloc(sizeof(XnPoint3D) * this->_aux_points->size());
			XnPoint3D *points_out = (XnPoint3D*)malloc(sizeof(XnPoint3D) * this->_aux_points->size());
			UINT16* ptr_16u = (UINT16*)this->_mat_depth16UC1.data;
			for(int i = 0 ; i < this->_aux_points->size() ; ++i){
				if(ptr_16u[this->_aux_points->at(i)->y * XN_VGA_X_RES + this->_aux_points->at(i)->x] > 1){
					points_in[i].X = this->_aux_points->at(i)->x;
					points_in[i].Y = this->_aux_points->at(i)->y;
					points_in[i].Z = ptr_16u[((int)points_in[i].Y) * XN_VGA_X_RES + ((int)points_in[i].X)]; 
				}
			}

			if(! this->_kinect->convert_to_realworld(this->_aux_points->size(),points_in,points_out)){
				this->_property_manager->_flag_processed[PropertyManager::P_MIRROR] = false;
					
			}
			else{
				for(int i = 0 ; i < this->_aux_points->size() ; ++i){
					points3d.push_back(new cv::Point3f(points_out[i].X,points_out[i].Y,points_out[i].Z));
				}
//.........这里部分代码省略.........
开发者ID:mariojgpinto,项目名称:Thesis,代码行数:101,代码来源:Controller.cpp


注:本文中的Floor::set_area方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。