本文整理汇总了C++中ConvexHull::FindConvex_QuickHull方法的典型用法代码示例。如果您正苦于以下问题:C++ ConvexHull::FindConvex_QuickHull方法的具体用法?C++ ConvexHull::FindConvex_QuickHull怎么用?C++ ConvexHull::FindConvex_QuickHull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConvexHull
的用法示例。
在下文中一共展示了ConvexHull::FindConvex_QuickHull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
cout<<"Hello from c++ from linux \n";
cout<<"Hello from c++ from windows \n";
cout<<"fix some bug\n";
Point2D ptA(1.0,1.0);
Point2D ptB(2.0,3.0);
Point2D ptC,ptD;
double tmp;
cout<<"Point A x=";cin>>tmp;ptA.x=(tmp);
cout<<"Point A y=";cin>>tmp;ptA.y=(tmp);
cout<<"Point B x=";cin>>tmp;ptB.x=(tmp);
cout<<"Point B y=";cin>>tmp;ptB.y=(tmp);
wcout<<"Distance="<<ptA.DistanceTo(ptB)<<endl;
cout<<"Point C x=";cin>>tmp;ptC.x=(tmp);
cout<<"Point C y=";cin>>tmp;ptC.y=(tmp);
cout<<"Point D x=";cin>>tmp;ptD.x=(tmp);
cout<<"Point D y=";cin>>tmp;ptD.y=(tmp);
LineSegment l1(ptA,ptB);
LineSegment l2(ptC,ptD);
double x,y;
int result=l1.Intersection2Segment(l2,x,y);
cout<<"Result ABxCD ="<<result<<"="<<x<<";"<<y<<endl;
ConvexHull cvh;
cvh.AddPoint(ptA);
cvh.AddPoint(ptB);
cvh.AddPoint(ptC);
cvh.AddPoint(ptD);
if(result)
{
cvh.AddPoint(Point2D(x,y));
}
cvh.FindConvex_QuickHull();
CPolygon resultConvex= cvh.m_Convex;
int numOfPoint=resultConvex.GetNumPoint();
for (int i=0;i<numOfPoint;i++)
{
cout<<"Point at "<<i<<"="<<resultConvex.GetPoint(i).x<<";"<<resultConvex.GetPoint(i).y<<endl;
}
cin.get();
return 1;
}