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


C++ polygon::get_edge2方法代码示例

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


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

示例1: repulsive

potential control_point::repulsive(polygon p1,polygon p2,polygon p3,polygon p4)
{
	// get shortest distances to all four obstacles from this control point
	float i,j,k,l;
	closest_point point1,point2,point3,point4;	
	float dist_min1=10,dist_min2=10,dist_min3=10,dist_min4=10;
	float x_min1,y_min1,x_min2,y_min2,x_min3,y_min3,x_min4,y_min4,potential_x,potential_y;
	potential p_r;
	
	// first obstacle: get edges one by one, then get the shortest distance to this edge, 
	//	           then determine which one is the shorest among four and then store
	//		   this shortest distance as well as x,y coordiantes of that point

	p1.get_edge1(i,j,k,l);	
	point1 = point_to_line_distance(i,j,k,l);
	if (point1.dist<=dist_min1){
		dist_min1 = point1.dist;
		x_min1 = point1.x;
		y_min1 = point1.y;
	}
	p1.get_edge2(i,j,k,l);
	point1 = point_to_line_distance(i,j,k,l);
	if (point1.dist<=dist_min1){
		dist_min1 = point1.dist;
		x_min1 = point1.x;
		y_min1 = point1.y;
	}
	p1.get_edge3(i,j,k,l);
	point1 = point_to_line_distance(i,j,k,l);
	if (point1.dist<=dist_min1){
		dist_min1 = point1.dist;
		x_min1 = point1.x;
		y_min1 = point1.y;
	}
	p1.get_edge4(i,j,k,l);
	point1 = point_to_line_distance(i,j,k,l);
	if (point1.dist<=dist_min1){
		dist_min1 = point1.dist;
		x_min1 = point1.x;
		y_min1 = point1.y;
	}

	// second obstacle: get edges one by one, then get the shortest distance to this edge, 
	//	           then determine which one is the shorest among four and then store
	//		   this shortest distance as well as x,y coordiantes of that point
	p2.get_edge1(i,j,k,l);
	point2 = point_to_line_distance(i,j,k,l);
	if (point2.dist<=dist_min2){
		dist_min2 = point2.dist;
		x_min2 = point2.x;
		y_min2 = point2.y;
	}
	p2.get_edge2(i,j,k,l);
	point2 = point_to_line_distance(i,j,k,l);
	if (point2.dist<=dist_min2){
		dist_min2 = point2.dist;
		x_min2 = point2.x;
		y_min2 = point2.y;
	}
	p2.get_edge3(i,j,k,l);
	point2 = point_to_line_distance(i,j,k,l);
	if (point2.dist<=dist_min2){
		dist_min2 = point2.dist;
		x_min2 = point2.x;
		y_min2 = point2.y;
	}
	p2.get_edge4(i,j,k,l);
	point2 = point_to_line_distance(i,j,k,l);
	if (point2.dist<=dist_min2){
		dist_min2 = point2.dist;
		x_min2 = point2.x;
		y_min2 = point2.y;
	}

	// third obstacle: get edges one by one, then get the shortest distance to this edge, 
	//	           then determine which one is the shorest among four and then store
	//		   this shortest distance as well as x,y coordiantes of that point
	p3.get_edge1(i,j,k,l);
	point3 = point_to_line_distance(i,j,k,l);
	if (point3.dist<=dist_min3){
		dist_min3 = point3.dist;
		x_min3 = point3.x;
		y_min3 = point3.y;
	}
	p3.get_edge2(i,j,k,l);
	point3 = point_to_line_distance(i,j,k,l);
	if (point3.dist<=dist_min3){
		dist_min3 = point3.dist;
		x_min3 = point3.x;
		y_min3 = point3.y;
	}
	p3.get_edge3(i,j,k,l);
	point3 = point_to_line_distance(i,j,k,l);
	if (point3.dist<=dist_min3){
		dist_min3 = point3.dist;
		x_min3 = point3.x;
		y_min3 = point3.y;
	}
	p3.get_edge4(i,j,k,l);
	point3 = point_to_line_distance(i,j,k,l);
//.........这里部分代码省略.........
开发者ID:pynpyn,项目名称:Robotic-Planning,代码行数:101,代码来源:youbot_plane.cpp


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