Boolean operations between triangle meshes
Boolean operations between triangle meshes
Abstract. Boolean operations is one of basic and well known on 3D models. The operations are widely used in computer graphics, game, CAD, EDA. The blog introduce the function in some open source program.
Key Words. Boolean Operations, Mesh, Triangle Mesh Boolean Operations,
1.Introduction
OpenCASCADE提供了基于BREP体的Boolean Operations,但是如果Topo体中只包含三角网格信息的话,是不支持布尔运算的。典型的例子就是由STL导入生成的模型在OpenCASCADE中是不能进行布尔运算。
有一些开源库提供了基于三角网格的布尔运算的功能。如MeshLab、Cork等。本文主要就来介绍一下这两个库中的基于三角网格的布尔运算功能。

Figure 1. Boolean Operation cut between Cylinder and Torus mesh
基于网格有布尔运算主要应用于没有几何信息的模型,如游戏、3D打印中的网格模型。
2.MeshLab CSG
MeshLab中提供了网格的布尔运算功能,源码在filter_csg中。程序界面如下图所示:

Figure 2. CSG Operation in MeshLab
下图所示为两个网格球的公共部分Intersection的结果:

Figure 3. Intersection between sphere meshes
由上图可以看出,经过布尔运算后,网格变密了。

Figure 4. Union between sphere meshes
上图所示为两个网格球的合并union结果。合并后的网格也变密了。

Figure 5. Difference between sphere meshes
3.Cork
Cork是一个小巧的用于网格布尔运算的开源库(LGPL),可以从如下地址下载:
下面使用cork编译出来的程序来测试下前面两个球的网格。在Windows中可以编译一个测试的应用程序,可以输入命令来测试效果:

Figure 6. Cork help info
将测试文件ballA.off和ballB.off复制到编译出来的程序wincork相同的文件夹中,分别输入以下命令来得到相应的布尔运算结果:
F:\Mesh\cork\win\wincork\>wincork -union balla.off ballb.off union.off F:\Mesh\cork\win\wincork\>wincork -diff balla.off ballb.off diff.off F:\Mesh\cork\win\wincork\>wincork -isct balla.off ballb.off isct.off
然后将生成的union.off、diff.off和isct.off在MeshLab中打开如下图所示:

Figure 7. Union between two sphere meshes

Figure 8. Difference between two sphere meshes

Figure 9. Intersection between two sphere meshes
从上面结果可以看出cork库得到的结果网格效果好,没有加密。
4. Conclusion
基于网格的布尔运算也是三维建模中一个基本功能,一些开源库提供了对网格进行布尔运算的支持。如MeshLab, Cork, CGAL等。
本文通过在MeshLab和Cork中对两个球的网格进行布尔运算,对比运算的结果,发现使用Cork得到的网格没有加密,数据量会小一些。
由于OpenCASCADE目前的版本不支持基于网格的布尔运算,在其官网上提供了一个功能请求:https://tracker.dev.opencascade.org/view.php?id=29776

Boolean operations between triangle meshes的更多相关文章
- Thread: BooleanRT : Realtime 3D boolean operations for (Runtime,Editor)
A Product by Mixed Dimensions What is BooleanRT? BooleanRT is a real-time 3D boolean operations exte ...
- OpenCascade Modeling Algorithms Boolean Operations
Modeling Algorithms Boolean Operations of Opencascade eryar@163.com 布尔操作(Boolean Operations)是通过两个形状( ...
- [算法]Comparison of the different algorithms for Polygon Boolean operations
Comparison of the different algorithms for Polygon Boolean operations. Michael Leonov 1998 http://w ...
- python开发_python中的Boolean运算和真假值
python中的真假值: Truth Value Testing Any object can be tested for truth value, for use in an if or while ...
- Computer Graphics Research Software
Computer Graphics Research Software Helping you avoid re-inventing the wheel since 2009! Last update ...
- CG&CAD resource
Computational Geometry The Geometry Center (UIUC) Computational Geometry Pages (UIUC) Geometry in Ac ...
- Fundamentals of Computer Graphics 中文版(第二版) (Peter Shirley 著)
1 引言 2 数学知识 3 光栅算法 4 信号处理 5 线性代数 6 矩阵变换 7 观察 8 隐藏面消除 9 表面明暗处理 10 光线追踪 11 纹理映射 12 完整的图形流水线 13 图形学的数据结 ...
- Discrete.Differential.Geometry-An.Applied.Introduction(sig2008)笔记
-------------------------------------------------------------- Chapter 1: Introduction to Discrete D ...
- zhihu spark集群,书籍,论文
spark集群中的节点可以只处理自身独立数据库里的数据,然后汇总吗? 修改 我将spark搭建在两台机器上,其中一台既是master又是slave,另一台是slave,两台机器上均装有独立的mongo ...
随机推荐
- windows tensorflow 版本与升级
tensorflow 的版本在 1.1.0/1.2.0 之后 api 迎来重大变化,有必要将版本升级到最新的 1.1.0 以上. 1. 使用 upgrade CPU:pip3 install –upg ...
- Django和Flask相对总结目录
Django中文文档官网:https://yiyibooks.cn/xx/Django_1.11.6/index.html Flask中文文档官网:https://dormousehole.readt ...
- java中"".equals(A)与A.equals("")一样不?
不一样如果a为nulla = null;a.equals("")出错nullPointerException如果写为"".equals(a)-->就可以防 ...
- python 中的property
""" property() 的第一个参数是 getter 方法,第二个参数是 setter 方法 xx = property(a,b) @property #用于指示g ...
- Functor& Monad解读
整体上代表封装的概念,重点是函数的封装,及函数运行的上下文环境.trait Functor[F[_]] Functor:代表整体封装: F[_]:代表封装后的目标域. A.B:代表普通的对象:f:代表 ...
- Chromium Graphics: Video Playback and Compositor
Video Playback and Compositor Authors: jamesr@chromium.org, danakj@chromium.org The Chromium composi ...
- 在 Ubuntu 18.04 LTS 无头服务器上安装 Oracle VirtualBox
作者: Sk 译者: LCTT qhwdw | 2018-10-12 01:59 本教程将指导你在 Ubuntu 18.04 LTS 无头服务器上,一步一步地安装 Oracle VirtualBox. ...
- [APIO2014]回文串 后缀自动机_Manancher_倍增
Code: // luogu-judger-enable-o2 #include <cstdio> #include <algorithm> #include <cstr ...
- ng-show ng-hide ng-if的区别
用途 ng-show ng-hide ng-if三个都可以用来控制页面DOM元素的显示与隐藏. ng-hide条件为true时,隐藏所在元素,false时显示所在元素. ng-show相反,条件为tr ...
- CF718C Sasha and Array(线段树维护矩阵)
题解 (不会矩阵加速的先去学矩阵加速) 反正我想不到线段树维护矩阵.我太菜了. 我们在线段树上维护一个区间的斐波那契的列矩阵的和. 然后询问时提取每个符合题意列矩阵的答案项(不是列矩阵存了两项吗,一个 ...