CGAL detect_features()创建不可保护的功能 [英] CGAL detect_features() creates unprotectable features

查看:70
本文介绍了CGAL detect_features()创建不可保护的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于示例(使用曲面将多面域重新网格化)在 3D网格生成手册)中,我想对一个立方体进行网格划分形的域,其中平面受到保护(请参见下面的代码).但是, make_mesh_3 会引发断言冲突:

Based on this example (Remeshing a Polyhedral Domain with Surfaces in the 3D Mesh Generation Manual), I want to mesh a cube-shaped domain with its midplane protected (see the code below). However, make_mesh_3 throws an assertion violation:

CGAL ERROR: assertion violation!
Expr: minimal_size_ > 0 || sq_d > 0

不要轻视示例,这只是为了显示问题.基于讨论,我认为问题是 detect_features 创建了相互相交的折线(中平面的周长与立方体边缘相交,并且都作为要素添加)

Nevermind the triviality of the example, it's just to show the problem. Based on this discussion, I think the issue is that detect_features creates polylines that intersect each other (perimeter of the midplane intersects the cube edges, and both are added as features).

meshdomain中不允许相交多面体吗?如果是这样,是否有一种方法可以访问和操纵 detect_features 的结果来处理冲突的功能?我试图弄清楚折线是如何存储在网格域中的,但是我却一无所获.

Are intersecting polyhedra not allowed in the meshdomain? If so, is there a way to access and manipulate the results of detect_features to process conflicting features? I'm trying to figure out how polylines are stored in the mesh domain, but I'm getting nowhere.

// --- External Includes ---
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_polyhedron_3.h>

#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/make_mesh_3.h>

// CGAL types
namespace cgal {

using Kernel            = CGAL::Exact_predicates_inexact_constructions_kernel;
using ConcurrencyTag    = CGAL::Sequential_tag;
using PolyhedronSurface = CGAL::Mesh_polyhedron_3<Kernel>::type;

using MeshDomain        = CGAL::Polyhedral_mesh_domain_with_features_3<Kernel>;
using Tr                = CGAL::Mesh_triangulation_3<MeshDomain,CGAL::Default,ConcurrencyTag>::type;
using Triangulation     = CGAL::Mesh_complex_3_in_triangulation_3<Tr>;
using MeshCriteria      = CGAL::Mesh_criteria_3<Tr>;

using Point             = cgal::MeshDomain::Point_3;
}



int main()
{
    // Define points for the cube and midPlane
    std::vector<cgal::Point> points = 
    {
        cgal::Point(  1.0,    0.0,    0.0),
        cgal::Point(  1.0,    1.0,    0.0),
        cgal::Point(  0.0,    1.0,    0.0),
        cgal::Point(  0.0,    0.0,    0.0),
        cgal::Point(  1.0,    0.0,    1.0),
        cgal::Point(  1.0,    1.0,    1.0),
        cgal::Point(  0.0,    1.0,    1.0),
        cgal::Point(  0.0,    0.0,    1.0),

        cgal::Point(  1.0,    0.0,    0.5),
        cgal::Point(  1.0,    1.0,    0.5),
        cgal::Point(  0.0,    1.0,    0.5),
        cgal::Point(  0.0,    0.0,    0.5)
    };

    // Create polyhedra
    cgal::PolyhedronSurface cube, midPlane;
    cube.make_triangle( points[0],  points[3],  points[1]);
    cube.make_triangle( points[1],  points[3],  points[2]);
    cube.make_triangle( points[4],  points[5],  points[7]);
    cube.make_triangle( points[5],  points[6],  points[7]);

    cube.make_triangle( points[0],  points[4],  points[3]);
    cube.make_triangle( points[3],  points[4],  points[7]);
    cube.make_triangle( points[1],  points[2],  points[5]);
    cube.make_triangle( points[2],  points[6],  points[5]);

    cube.make_triangle( points[2],  points[3],  points[6]);
    cube.make_triangle( points[3],  points[7],  points[6]);
    cube.make_triangle( points[0],  points[1],  points[5]);
    cube.make_triangle( points[0],  points[5],  points[4]);

    midPlane.make_triangle( points[8],  points[9],  points[10]);
    midPlane.make_triangle( points[8],  points[10], points[11]);

    // Triangulation
    cgal::MeshDomain meshDomain( midPlane, cube );
    meshDomain.detect_features();

    cgal::MeshCriteria meshCriteria(    CGAL::parameters::facet_angle   = 30,
                                        CGAL::parameters::edge_size     = 0.2 );

    auto triangulation = CGAL::make_mesh_3<cgal::Triangulation>(    meshDomain,
                                                                    meshCriteria );

    return 0;
}

推荐答案

对于您的立方体,应该容易地构造多面体复合体,即三个表面,即立方体的上部和下部以及中间的正方形.看看此示例.

For your cube it should be easy to construct a polyhedral complex, that is three surfaces, namely the upper and lower part of the cube, and the mid-square. Have a look at this example.

这篇关于CGAL detect_features()创建不可保护的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆