本文整理汇总了C++中ConvexPolygon::calculateMatrixForm方法的典型用法代码示例。如果您正苦于以下问题:C++ ConvexPolygon::calculateMatrixForm方法的具体用法?C++ ConvexPolygon::calculateMatrixForm怎么用?C++ ConvexPolygon::calculateMatrixForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConvexPolygon
的用法示例。
在下文中一共展示了ConvexPolygon::calculateMatrixForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processEnvironment
//.........这里部分代码省略.........
dy1 = dy1 > 0 ? -1 : 1;
dx2 = dx2 > 0 ? -1 : 1;
dy2 = dy2 > 0 ? -1 : 1;
current_endpoints[cl1].first += dx1;
current_endpoints[cl1].second += dy1;
current_endpoints[cl2].first += dx2;
current_endpoints[cl2].second += dy2;
// cout<<"d: "<<dx1<<" "<<dy1<<", "<<dx2<<" "<<dy2<<" eps "<<cl1<<" "<<cl2<<endl;
dx3 = current_endpoints[cl1].first - current_endpoints[cl2].first;
dy3 = current_endpoints[cl1].second - current_endpoints[cl2].second;
if(abs(dx3) < MAX_XDIST) {
//move away from each other
if(dx3 > 0) {
dx1 =2;
dx2 =-2;
} else {
dx2 =2;
dx1 =-2;
}
}
if(abs(dy3) < MAX_YDIST) {
//move away from each other
if(dy3 > 0) {
dy1 =2;
dy2 =-2;
} else {
dy2 =2;
dy1 =-2;
}
}
//cout<<"d: "<<dx1<<" "<<dy1<<", "<<dx2<<" "<<dy2<<" eps "<<cl1<<" "<<cl2<<endl;
current_endpoints[cl1].first += dx1;
current_endpoints[cl1].second += dy1;
current_endpoints[cl2].first += dx2;
current_endpoints[cl2].second += dy2;
}
bool doGrow = true;
//trace polygon as well
for(int q = 1; q<current_endpoints.size(); q++) {
//cout<<current_endpoints[q-1].first<<" "<<current_endpoints[q-1].second<<" to "<<current_endpoints[q].first<<" "<<current_endpoints[q].second;
if(!traceLine(current_endpoints[q-1].first,current_endpoints[q-1].second,
current_endpoints[q].first,current_endpoints[q].second,idxmin,idxmax)) {
doGrow = false;
break;
}
//cout<<" OK\n";
}
if(!doGrow) break;
//cout<<current_endpoints.back().first<<" "<<current_endpoints.back().second<<" to "<<current_endpoints.front().first<<" "<<current_endpoints.front().second;
if(!traceLine(current_endpoints.back().first,current_endpoints.back().second,
current_endpoints.front().first,current_endpoints.front().second,idxmin,idxmax)) {
break;
}
//cout<<" OK\n";
best_endpoints = current_endpoints;
nMoves++;
}
//dummy 0.5 m in each direction
/* Eigen::Vector2d s;
Eigen::Vector2d ul, ll, lr, ur;
ul<<-len/2,len/2;
ll<<-len/2,-len/2;
lr<<len/2,-len/2;
ur<<len/2,len/2;
s = poly.seed + ul;
poly.endpoints.push_back(s);
s = poly.seed + ll;
poly.endpoints.push_back(s);
s = poly.seed + lr;
poly.endpoints.push_back(s);
s = poly.seed + ur;
poly.endpoints.push_back(s);
*/
//go through best_endpoints, compute vector position and add in polygon
for(int q=0; q<best_endpoints.size(); q++) {
pixel.x = best_endpoints[q].second;
pixel.y = best_endpoints[q].first;
map->pixel2world(pixel,vec);
poly.endpoints.push_back(vec);
}
poly.theta_min = -1;
poly.theta_max = 1;
poly.phi_min = -1;
poly.phi_max = 1;
poly.v_min = -1;
poly.v_max = 1;
poly.w_min = -1;
poly.w_max = 1;
poly.calculateMatrixForm();
polygons.push_back(poly);
//cout<<"added poly at "<<poly.seed<<endl;
}
}