c++:CGAL 2D delauny 三角剖分:凹形

发布于 2024-08-13 08:25:58 字数 213 浏览 5 评论 0原文

我目前正在使用 CGAL 来完成一些 2D 三角测量任务,并且我还准备了一些简单的工作。无论如何,我真的不知道如何对凹形状进行三角剖分,因为现在我总是得到所有点的凸包。基本上我想在 mouseClick 上添加点,类似于它在 illustrator 中的工作方式,以便按顺序排列的所有点都是形状的轮廓。我怎样才能用 CGAL 做到这一点?一个关于如何对凹形状进行三角测量的简单示例可能会让我走上正确的轨道!谢谢!

I am currently getting into CGAL for some 2D triangulation tasks and I also got something simple to work allready. Anyhow I dont really get how to triangulate concave shapes since Right now I always get the convex hull of all points. Basically I want to add points on mouseClick similar to how it works in illustrator so that all the points in their order are the outline of the shape. How can I do that with CGAL? A simple example of how to triangulate concave shapes in general would propably put me onto the right track! thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

↘紸啶 2024-08-20 08:25:58

我想您首先需要分区 将多边形分割成凸块。之后,您可以使用如下内容创建每个单独多边形的三角形:

for (int i = 1; i + 1 < polygon.size(); ++i) {
    const Point_2& v0 = polygon[0];
    const Point_2& v1 = polygon[i];
    const Point_2& v2 = polygon[i + 1];
}

I guess you'll first need to partition the polygon into convex pieces. After this you can create triangles of each individual polygon with something like this:

for (int i = 1; i + 1 < polygon.size(); ++i) {
    const Point_2& v0 = polygon[0];
    const Point_2& v1 = polygon[i];
    const Point_2& v2 = polygon[i + 1];
}
盗心人 2024-08-20 08:25:58

如果您得到的是凸轮廓而不是凹轮廓,则可能是由于传入的 alpha 值所致。尝试使用 find_optimal_alpha(1) 作为 alpha 值或计算相对于您传入的点云边界大小的值。例如。

Alpha_shape_2 aShape(inPoints.begin(), inPoints.end());
aShape.set_alpha( aShape.find_optimal_alpha(1) );
aShape.set_mode(Alpha_shape_2::REGULARIZED);

If you're getting a convex outline instead of concave, it's probably due to the alpha value passed in. Try using find_optimal_alpha(1) as the alpha value or calculate values relative to the bounding size of the point cloud you're passing in. eg.

Alpha_shape_2 aShape(inPoints.begin(), inPoints.end());
aShape.set_alpha( aShape.find_optimal_alpha(1) );
aShape.set_mode(Alpha_shape_2::REGULARIZED);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文