【发布时间】:2018-11-27 03:47:26
【问题描述】:
我试图找出 CGAL 中两个单位半径圆的交点。受 CGAL 示例代码和教程的启发,我成功地创建了以下代码。但不幸的是,我无法打印出分数。我注意到向量的大小是交点的数量。任何帮助将不胜感激,因为我是 CGAL 的新手。
#include <CGAL/Circular_kernel_intersections.h>
#include <CGAL/Exact_circular_kernel_2.h>
typedef CGAL::Exact_circular_kernel_2 Circular_k;
typedef CGAL::Point_2<Circular_k> Point_2;
typedef CGAL::Circle_2<Circular_k> Circle_2;
typedef CGAL::Circular_arc_2<Circular_k> Circular_arc_2;
typedef CGAL::CK2_Intersection_traits<Circular_k, Circle_2, Circle_2>::type Intersection_result;
using namespace std;
int main() {
Point_2 p(2,2), r(5.5,2);
Circle_2 c1(p,1), c2(r,1);
vector<Intersection_result> res;
intersection(c1,c2,back_inserter(res));
cout << res.size() << endl;
}
【问题讨论】:
标签: c++ computational-geometry cgal