三维建模方法之CSG与B-Rep比较

来源:互联网 发布:买淘宝新开店铺的东西 编辑:程序博客网 时间:2024/04/27 14:52
 

转于http://3dke.blogbus.com/logs/61375826.html

  计算机中表示三维形体的模型,按照几何特点进行分类,大体上可以分为三种:线框模型、表面模型和实体模型。如果按照表示物体的方法进行分类,实体模型基本上可以分为分解表示、构造表示CSG(Constructive Solid Geometry)和边界表示BREP(Boundary Representation)三大类。
 
  常用的分解表示法有:四叉树、八叉树、多叉树、BSP树等等。
  构造表示的主要方法:扫描表示、构造实体几何表示、特征和参数化表示。
  边界表示的典型代表是翼边结构。
 
  CSG建模法,一个物体被表示为一系列简单的基本物体(如立方体、圆柱体、圆锥体等)的布尔操作的结果,数据结构为树状结构。树叶为基本体素或变换矩阵,结点为运算,最上面的结点对应着被建模的物体;而BREP的一个物体被表示为许多曲面(例如面片,三角形,样条)粘合起来形成封闭的空间区域。
   
  BRep优点:
  1. 有较多的关于面、边、点及其相互关系的信息。 
  2. 有利于生成和绘制线框图、投影图,有利于计算几何特性,易于同二维绘图软件衔接和同曲面建模软件相关联。


  BRep局限:
  由于它的核心信息是面,因而对几何物体的整体描述能力相对较差,无法提供关于实体生成过程的信息,也无法记录组成几何体的基本体素的元素的原始数据,同时描述物体所需信息量较多,边界表达法的表达形式不唯一。
 
  CSG优点:
  方法简洁,生成速度快,处理方便,无冗余信息,而且能够详细地记录构成实体的原始特征参数,甚至在必要时可修改体素参数或附加体素进行重新拼合。数据结构比较简单,数据量较小,修改比较容易,而且可以方便地转换成边界(Brep)表示。
 
  CSG局限:
  由于信息简单,这种数据结构无法存贮物体最终的详细信息,例如边界、顶点的信息等。由于CSG表示受体素的种类和对体素操作的种类的限制,使得它表示形体的覆盖域有较大的局限性,而且对形体的局部操作(例如,倒角等等)不易实现,显示CSG表示的结果形体时需要的间也比较长。

  到底使用哪种方法呢?取决于不同的视角,他们各自都有优缺点,可以从以下几点来考虑:
  1.现实 - 模型是否需要近似实际的材质密度,厚度和体积,或者是否需要显示真实的曲面细节
  2.精度 - 需要什么样的精度级别
 
  混合模式(Hybird Model)是建立在BRep与CSG的基础上,在同一系统中,将两者结合起来,共同表示实体的方法。以CSG法为系统外部模型,以B-Rep法为内部模型,CSG法适于做用户接口,而在计算机内部转化为B-Rep的数据模型。相当于在CSG树结构的结点上扩充边界法的数据结构。混合模式是在CSG基础上的逻辑扩展,起主导作用的是CSG结构,B-Rep的存在,减少了中间环节中的数学计算量,可以完整的表达物体的几何、拓扑信息,便于构造产品模型。
 
  还有空间划分表示法,利用四叉树或八叉数的数据结构来表示2D/3D的模型。

--------------------------------

To determine if the B-rep model of the handle was actually smaller than models created using the CSG method, a sample handle was created using both of these methods. The CSG method produced a model that used 50% more disk space than the B-rep method handle. It was also more difficult to construct, and required more constraint equations and variables. Clearly, the B-rep method was indeed the best choice for this model.

Next, a similar study was conducted for the connector model. Again, the same model was created using CSG and B-rep methods. The CSG method did have to use a profile and circular sweep to construct the countersink on the bottom of the connector. For this set of models, the CSG method had a 10% smaller file size, and was easier to construct. This is most likely due to the complex profile that had to be created for the B-rep method. By constructing this part as a series of co-axial cylinders that all start at the same point, but have different heights and diameters, the process was significantly simpler than the original design. The original design for the CSG model used cylinders stacked on top of each other, and the inside part of the connector was not hollow. The decision to create a hollow center in the connector complicated the B-rep method significantly, but simplified the CSG method. Due to this change, the connector model would probably have been better created using the CSG method from this test.

The third family was simply a profile, so those parts could not be made with CSG methods. For the fourth family, the main body of the part was again constructed with B-rep and a combination of B-rep and CSG methods. Again, the method that used CSG proved to be a better choice. A CSG box primitive of the proper size was inserted. Then, a B-rep rotate face operation was performed on two of the faces. The pure B-rep method required that the cplane first be changed from the default top cplane to the right cplane. The profile had to be inserted in two parts and then unioned. The profile was extruded, and the cplane changed back to the top cplane. This required six commands, and multiple attempts before the profile could be constructed correctly. The B-rep method also resulted in a 10% larger disk file.

 

 

 

目前, 常用的特征(Feature)的表示方法主要有以下三种:

  (1) 基于B-rep的方法: 在B-rep 方法中, 特征被定义为一个零件的相互联系的面的集合(面集)。 这些特征也被称为“面特征”。 B-rep 模型是基于图的, 所有的几何/拓扑信息显式地表达在面棗边棗顶点图中, 因此, B-rep模型常被称为赋值的模型。 B-rep 表示特征的方法受到许多研究者的喜欢, 这是因为可以得到充足的信息以及它是基于图的表示方法(许多特征识别系统是基于图表示的)。B-rep模型可以与属性值(如, 表面粗糙度, 材料等)、尺寸和公差联系在一起,B-rep方法的缺点是它与特征体素和体积特征没有直接的联系, 特征操作(如, 删除特征)难于进行。


  (2) 基于CSG 的方法: 基于CSG 的特征表达方法将特征定义为体积元素,体积元素通过布尔操作构造零件。 使用CSG 表示方法简捷、有效、易于编辑和操作体素,并提供CSG和特征体素之间有意义的联系, 而且二叉树可用于特征模型的构造。 对于特征提取,CSG 模型的主要问题是其表示的不唯一性, 以及缺少对低层的构形元素的显式表达。然而,给CSG 模型赋值, 推导出其相应的边界表示, 就可以克服这些问题。


  (3) 基于混合CSG/B-rep的方法: 由于CSG 和B-rep表示方法都各有优缺点,因此,汲取二者优点的混合表示方法便产生了。Nnaji和Liu开发了一个工艺规划系统,可以提取基于CSG 的信息(B-rep信息是由CSG 模型导出的)。重新构造CSG 树和B-rep信息,使其成为以一种混合形式来表示特征的另一种CSG 树。Roy和Liu提出一种混合CSG/B-rep方法表示特征及尺寸和公差。特征的层次结构提供物体组件关系的多级表示,并在每级的细节保持有边界表示。Gossard等人提出一种在几何造型中显式地表示尺寸公差和几何特征的方法,此方法将CSG 和B-rep表示结合在一个被称为形体图的图结构中。