OCCT的拓朴表示

来源:互联网 发布:网络安全工程师考证 编辑:程序博客网 时间:2024/04/29 02:16

      OCCT的拓朴表示采用BREP形式,可以支持non-manifold实体。

       OCCT的拓朴表示分为两层:拓朴对象层和BREP表示层。

       先看拓朴对象层,如下是类继承关系:

       TopoDS_Shape

       ――TopoDS_Solid

       ――TopoDS_Shell

       ――TopoDS_Face

       ――TopoDS_Edge

       ――TopoDS_CompSolid 

       ――TopoDS_Compound 

       ――TopoDS_Vertex      

       ――TopoDS_Wire

       这里,shape对象是一个对下层拓朴对象的引用(reference),并记录对象的位置和方向属性。这里可以针对不同位置或方向的同一个底层对象,实现共享。属性三个:

       Handle_TopoDS_TShapemyTShape;//底层对象

TopLoc_LocationmyLocation;//位置信息

TopAbs_OrientationmyOrient;//方向。

上述这些对象,都是一些引用,结构和简单。具体的拓朴信息和几何信息在Tshape中。下面看TopoDS_Tshape的继承关系:

TopoDS_TShape     

――TopoDS_TWire

――TopoDS_TVertex    

――――BRep_TVertex   

――TopoDS_TSolid      

――TopoDS_TShell      

――TopoDS_TFace      

――――BRep_TFace     

――TopoDS_TEdge      

――――BRep_TEdge     

――TopoDS_TCompSolid      

――TopoDS_TCompound      

       这里TopoDS开始的类是拓朴层的类,Brep开始的类是具体的BREP表示层的类。Tshape具有如下主要的属性:

       TopoDS_ListOfShapemyShapes;

Standard_IntegermyFlags;

即每个Tshape有一系列的TopoDS_Shape(引用)组成,每个引用记录的相应的几何信息和拓朴信息。例如:一个Twire可能由多个Edge组成等。如下是类的一些简单说明:

  • Tvertex: A  Vertex is a topological  point in two or three dimensions
  • TedgeA topological part  of a curve  in 2D or 3D,  the boundary is a set of oriented    Vertices
  • TwireA set of edges connected by theirvertices
  • Tface: A  topological part  of a surface   or  of the 2D space.The  boundary  is a   set of  wires  and vertices.
  • TshellA set of faces connected by theiredges.
  • Tsolid: ATopological part of 3D space, bounded by shells, edges and vertices.
  • TCompSolid; Aset of solids connected by their faces.
  • TCompound; ATCompound is an all-purpose set of Shapes.

 

总之,TcompSolid由一系列的Solid组成,每个TSolid由一系列的Shell组成,每个TShell由一系列的Face组成,每个TWire由一系列的Edge组成,每个Tedge由一系列的Vertex组成。当然,不是随便就可以组成的,还是有要求的,比如:Face组成Tshell要求Face的边境相连等。

上述的声明和实现主要在TopoDS package中。

上述TopoDS_T*类,主要是上面显示的两种属性。具体的几何数据和拓朴数据由BREP层实现。

BREP层描述了一个Boundary  Representation Data   Structure,并通过继承TopoDS层的类,添加了几何信息。从上可以看出,有三个主要的实现类:

Brep_Tvertex Brep_Tedge Brep_Tface类。

先从简单的Brep_Tvertex类说起。Tvertex表示一个节点拓朴对象,包含了一个3D点信息和一个Tolerance信息,如下:

gp_Pnt myPnt;

Standard_RealmyTolerance;

BRep_ListOfPointRepresentationmyPoints;

第三个属性目前似乎没有使用。

再看Brep_Tedge类,改类比较复杂,看OCCT的文档说明:

The TEdge fromBRep is  inherited from  the Tedge from TopoDS. It contains the geometric dataThe TEdge contains :

  •        * A tolerance.
  •        * A same parameter flag.
  •        * A same range flag.
  •        * A Degenerated flag.
  •        * A  list   of curve representation.

 

属性如下:

Standard_RealmyTolerance;

Standard_IntegermyFlags;

BRep_ListOfCurveRepresentationmyCurves;

其中,比较复杂的是listofcurve属性。每个Edge包含了一系列各类的curve,看一些OCCT的文档说明:

An Edge is  defined by a list  of curve representations which are either :

    -- Geometric representations :

  •     * A 3d curve (at most one)  3D曲线。
  •     * A curve on surface, curve in parametricspace. 参数曲线
  •     * A curve on closed surface, two curves inparametric space.例如圆柱的边。

 

    -- Polygonal representations : 剖分后的数据。

  •     * A 3d polygon (at most one).
  •     * A Polygon on triangulation (array ofnode indices)
  •     * A Polygon on closed triangulation (2arrays of node indices)
  •     * A polygon on surface (array of 2d pointsin parametric space)

 

   

    -- Curve on 2 surfaces :

    * This is used for storing shapecontinuity.

  足够的复杂了。下面看一些list中可能有那些类:

BRep_CurveRepresentation      

――BRep_PolygonOnTriangulation

――――BRep_PolygonOnClosedTriangulation      

――BRep_PolygonOnSurface

――――BRep_PolygonOnClosedSurface      

――BRep_Polygon3D    

――BRep_GCurve

――――BRep_Curve3D      

――――BRep_CurveOnSurface    

――――――BRep_CurveOnClosedSurface

――BRep_CurveOn2Surfaces 

这些类很多,后面再详细补充,主要关注如下类:

Gcurve类:表示是几何曲线类,可能是3D曲线(Curve3D),也可能是参数曲线(CurveOnSurface类),而参数曲线可能是闭合曲线的参数曲线(CurveOnClosedSurface类)。

裁剪曲面中,裁剪环中的裁剪曲线,就是使用CurveOnSurface表示的。

通常,如果一条曲线是单独的3D曲线,则listofcurve中通常只包含Curve3d。如果一个曲线是一个裁剪曲线,则通常包括一条3d曲线和一个参数曲线。当所在曲面进行了剖分后,则还会有对于的polygon数据。这也是为什么使用list记录这些信息的原因。

先到这里,下面看Tface

先看OCCT文档说明:

The TFacecontains :

  •        * A suface, a tolerance and a Location.
  •        * A NaturalRestriction flag,   when this flag  is True the  boundary of the  face is known to be the parametric space (Umin, UMax, VMin,VMax).
  •        * An    optionalTriangulation.   If  there is a triangulation the surface can be absent.
  •        * The  Location is  used  for the Surface.
  •        *  The triangulation  is in the samereference system  than the TFace.     A point on mySurface must   be transformed with myLocation,  but not a point  on thetriangulation.
  •        *  The Surface may  be shared bydifferent TFaces but not the Triangulation, because the Triangulation may be modified by the edges.

 

 

Tface包括如下属性:

  • Handle_Geom_SurfacemySurface; 关联的geom层的曲面信息,这个曲面可能是无界曲面,例如:Plane
  • Handle_Poly_TriangulationmyTriangulation; Face网格剖分后生成的网格数据。主要用于显示时使用。
  • TopLoc_LocationmyLocation;曲面的位置信息,为了便于同一个曲面在不同位置显示时的数据共享。
  • Standard_RealmyTolerance; 曲面的误差。
  • Standard_BooleanmyNaturalRestriction; 是否自然参数限制的曲面,当是自然限制时,曲面被矩形参数区域[U1,U2]×[V1,V2]限制,否则,为裁剪曲线限制,参数裁剪区域通常不是规则的矩形区域。

 

通常,一个裁剪曲面Tface,除包含上述信息外,还会包含一系列的Wireshape,这些wire构成了Tface的多个裁剪环,其中一个为外环,0个或多个内环。

拓朴的基本表示先总结到此,后续再逐步随学习深入之。

 

原创粉丝点击