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 ...
随机推荐
- zzulioj--1805-- SC和ta的游泳池(简单几何)
1805: SC和ta的游泳池 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 154 Solved: 43 SubmitStatusWeb Boar ...
- poj--1789--Truck History(prim)
Truck History Time Limit: 2000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64u Submit ...
- BZOJ 4269 高斯消元求线性基
思路: 最大: 所有线性基异或一下 次大: 最大的异或一下最小的线性基 搞定~ //By SiriusRen #include <cstdio> #include <algorith ...
- js thousand separator and change td content
js thousand seprator and change TD content // integer function addCommas(n){ })/; return String(n).r ...
- 大数问题(相加) A + B
I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum o ...
- 陌上开花(CDQ分治)
题解 三维偏序裸题... 一般三维偏序是第一维排序,第二维CDQ分治,第三维树状数组. 模板题还是看代码吧... #include<iostream> #include<cstrin ...
- [POI2009]KON-Ticket Inspector(二维前缀和+DP)
题意 有n个车站,现在有一辆火车从1到n驶过,给出aij代表从i站上车j站下车的人的个数.列车行驶过程中你有K次检票机会,所有当前在车上的人会被检票,问最多能检多少个不同的人的票 (n<=600 ...
- zabbix4.0 使用nginx前端安装
注:环境需求:centos7 1.安装阿里云yum源: rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.1/rhel/7/x86_64/zabb ...
- vsCode 快捷键、插件
插件 参考链接:https://blog.csdn.net/shunfa888/article/details/79606277 快捷键及常用插件:https://www.jianshu.com/p/ ...
- HDU 4941 Magical Forest (Hash)
这个题比赛的时候是乱搞的,比赛结束之后学长说是映射+hash才恍然大悟.因此决定好好学一下hash. 题意: M*N的格子,里面有一些格子里面有一个值. 有三种操作: 1.交换两行的值. 2.交换两列 ...