本文整理汇总了C++中Triangulation::segment方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangulation::segment方法的具体用法?C++ Triangulation::segment怎么用?C++ Triangulation::segment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangulation
的用法示例。
在下文中一共展示了Triangulation::segment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solve
void solve(Triangulation DT, Segment rect[],vector<Point> points)
{
map<TP,double> vertex_dist;
for (vertex_iterator vit = DT.finite_vertices_begin();vit!=DT.finite_vertices_end();vit++)
{
TP vertex_p = vit->point();
double min_dist = min_segment(rect, vertex_p);
vertex_dist[vertex_p] = min_dist;
}
for(Edge_iterator eit= DT.finite_edges_begin(); eit!=DT.finite_edges_end();eit++)
{
double min_dist = CGAL::to_double(DT.segment(eit).squared_length()/4);
TP vertex_p1 = eit->first->vertex(DT.cw(eit->second))->point();
TP vertex_p2 = eit->first->vertex(DT.ccw(eit->second))->point();
vertex_dist[vertex_p1] = std::min(vertex_dist[vertex_p1], min_dist);
vertex_dist[vertex_p2] = std::min(vertex_dist[vertex_p2], min_dist);
}
vector<double> dist;
for (std::map<TP,double>::iterator it = vertex_dist.begin();it!= vertex_dist.end(); it++)
{
dist.push_back(it->second);
}
sort(dist.begin(),dist.end());
int f,m,l;
f = time(dist[0]);
m = time(dist[points.size()/2]);
l = time(dist[points.size() - 1]);
cout<<f<<" "<<m<<" "<<l<<endl;
}