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


C++ Face_handle::ccw方法代码示例

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


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

示例1: as

/**
 * Returns an alpha shape but as lines instead of only points.
 */
std::list<std::pair<Shared_Point,Shared_Point> > Hull::alphaHull2D(const std::list<Point> points,double alpha){
	//iHt dt;
	std::list<std::pair<Shared_Point,Shared_Point> > resultingEdges;
	if(points.size() < 3) return resultingEdges;

	#ifdef NO_HULL_CALCULATION
	if(points.size() == 4){
		std::list<Point>::const_iterator it = points.begin();
		Shared_Point p0(new Point(it->p[0], 0, it->p[2]));
		it++;
		Shared_Point p1(new Point(it->p[0], 0, it->p[2]));
		it++;
		Shared_Point p2(new Point(it->p[0], 0, it->p[2]));
		it++;
		Shared_Point p3(new Point(it->p[0], 0, it->p[2]));

		resultingEdges.push_back(std::pair<Shared_Point,Shared_Point>(p0,p1));
		resultingEdges.push_back(std::pair<Shared_Point,Shared_Point>(p1,p2));
		resultingEdges.push_back(std::pair<Shared_Point,Shared_Point>(p2,p3));
		resultingEdges.push_back(std::pair<Shared_Point,Shared_Point>(p3,p0));
		
		return resultingEdges;
	}else{
			fprintf(stderr,"Cannot Compute no hull\n");
	}
	#endif

	std::vector<K::Point_2> dt;
	dt.reserve(points.size());

	for(std::list<Point>::const_iterator it=points.begin(); it!=points.end(); it++){
		K::Point_2 p((*it).p[0],(*it).p[2]);
		dt.push_back(p);
	}

	try{
        Alpha_shape_2 as(dt.begin(),dt.end(),alpha);//Alpha_shape_2::REGULARIZED);
		//Alpha_shape_2 as(dt.begin(),dt.end(),Alpha_shape_2::REGULARIZED);
		//std::cout << "Alpha shape computed in REGULARIZED mode by defaut."<< std::endl;

		//Alpha_iterator opt = as.find_optimal_alpha(1);
		//as.set_alpha(*opt);

		for(Alpha_shape_2::Alpha_shape_edges_iterator it = as.alpha_shape_edges_begin(); it != as.alpha_shape_edges_end(); it++){
			Edge e = (*it);
			Face_handle f = e.first;
			int i = e.second;

			Alpha_shape_2::Vertex_handle vh1 = f->vertex(f->cw(i));
			Alpha_shape_2::Vertex_handle vh2 = f->vertex(f->ccw(i));
			K::Point_2& p1 = vh1->point();
			K::Point_2& p2 = vh2->point();
			
			std::pair<Shared_Point,Shared_Point> pair(Shared_Point(new Point(p1.x(),0,p1.y())),Shared_Point(new Point(p2.x(),0,p2.y())));
			resultingEdges.push_back(pair);
		}

	}catch( ...){
		printf("Catched Unknown Cgal Exception adding plane without generatig shape\n");
	}
	return resultingEdges;

}
开发者ID:MarkusEich,项目名称:segmentation,代码行数:66,代码来源:hull.cpp


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