利用CGAL对网格填洞( Filling holes)

本文详细介绍了如何利用CGAL库中的半边结构Halfedge Data Structure进行网格填洞操作,同时探讨了CGAL的三层结构,包括Polyhedron Layer、Halfedge data structure Layer和Items Layer的功能。此外,还解释了如何使用triangulate_polyhedron.h对多面体进行三角化,通过映射到二维平面和Delaunay三角化实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CGAL的资料尤其是中文资料少之又少,现根据自己要完成的工作进行一个记录和总结,也希望能填补资料的空缺。

在CGAL中,使用半边结构Halfedge Data Structure来存储网格信息,另外一个类似于CGAL的库OpenMesh同样使用的是这种半边结构。

关于半边结构,请点这里:http://www.flipcode.com/archives/The_Half-Edge_Data_Structure.shtml

 

CGAL内部通过三层结构(Polyhedron Layer、Halfedge data structure Layer、Items Layer)实现半边结构,如图所示:

hds_design_col.png

Polyehdron Layer 提供了易用的借口,我们可以通过Halfedge_Handle 、 Facet_Handle、 Vertex_Handle及对应的迭代器Iterator来进行访问、遍历及更新数据。同时也可以通过一些简单的成员函数进行欧拉操作(Euler Operations)等。

Items Layer 负责存储底层的数据,包括顶点Vertex、Halfedge、Face的信息。

中间层Halfedge_data_structure Layer负责组织和管理Items Layer的信息,内部使用双向链表(bidirectional list)或者容器(vector)来实现。

 

在CGAL的Include目录里有一个undocumented头文件:triangulate_polyhedron.h,顾名思义这个头文件的作用是对多面体进行三角化的。

通过这个库文件引用的头文件可以看得出CGAL是通过Triangulation_2_filtered_projection_traits_3.h将三维坐标点映射到二维平面上,再通过Constrained_Delaunay_triangulation_2.h对其进行三角化,随后通过HalfedgeDS_decorator.h对原多面体进行三角化。

我将此库文件进行重新注释解读如下:

// Copyright (c) 2010-2011  GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s)     : Laurent Rineau

#ifndef CGAL_TRIANGULATE_POLYHEDRON_H

#include <CGAL/Modifier_base.h>
#include <CGAL/HalfedgeDS_decorator.h>

#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Co
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值