本文整理汇总了C++中polygon::get_edge1方法的典型用法代码示例。如果您正苦于以下问题:C++ polygon::get_edge1方法的具体用法?C++ polygon::get_edge1怎么用?C++ polygon::get_edge1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polygon
的用法示例。
在下文中一共展示了polygon::get_edge1方法的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);
//.........这里部分代码省略.........