我知道,在CGAL中,我们可以通过以下方式访问Point_2的元素:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
Point_2 points(1.0,1.0);
int main(){
std::cout<<points.x()<<"\t"<<points.y();
return 0;}但我如何才能对一系列的点做到这一点:
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef std::vector<Point_2> Vector;
Vector points;
points.reserve(N);
int main(){
points[0].x() =1;
points[0].y() =1;
return 0;}X()或pointsi.x会产生错误。
发布于 2016-07-21 15:46:09
正如评注中所提到的那样,你可以:
int main(){
points.push_back(Point_2(1.0,1.0));
return 0;
}https://stackoverflow.com/questions/37371526
复制相似问题