OCCT的拓朴结构
??OCCT 的拓樸表示采用 BREP 形式,可以支持 non-manifold 實體。
???????OCCT 的拓樸表示分為兩層:拓樸對象層和 BREP 表示層。
???????先看拓樸對象層,如下是類繼承關(guān)系:
???????TopoDS_Shape
???????―― TopoDS_Solid
???????―― TopoDS_Shell
???????―― TopoDS_Face
???????―― TopoDS_Edge
???????―― TopoDS_CompSolid?
???????―― TopoDS_Compound?
???????―― TopoDS_Vertex??????
???????―― TopoDS_Wire
???????這里, shape 對象是一個對下層拓樸對象的引用( reference ),并記錄對象的位置和方向?qū)傩浴_@里可以針對不同位置或方向的同一個底層對象,實現(xiàn)共享。屬性三個:
???????Handle_TopoDS_TShape myTShape;// 底層對象
TopLoc_Location myLocation;// 位置信息
TopAbs_Orientation myOrient;// 方向。
上述這些對象,都是一些引用,結(jié)構(gòu)和簡單。具體的拓樸信息和幾何信息在 Tshape 中。下面看 TopoDS_Tshape 的繼承關(guān)系:
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_ListOfShape myShapes;
Standard_Integer myFlags;
即每個 Tshape 有一系列的 TopoDS_Shape (引用)組成,每個引用記錄的相應的幾何信息和拓樸信息。例如:一個 Twire 可能由多個 Edge 組成等。如下是類的一些簡單說明:
Tvertex: A??Vertex is a topological??point in??two or three dimensions 。
Tedge : A topological part??of a??curve??in 2D or 3D,??the boundary is a set of oriented????Vertices 。
Twire : A set of edges connected by their vertices 。
Tface: A??topological part??of a surface???or??of the??2D space.The??boundary??is??a???set of??wires???and vertices.
Tshell : A set of faces connected by their edges.
Tsolid: A Topological part of 3D space, bounded by shells, edges and vertices.
TCompSolid; A set of solids connected by their faces.
TCompound; A TCompound is an all-purpose set of Shapes.
?
總之, TcompSolid 由一系列的 Solid 組成,每個 TSolid 由一系列的 Shell 組成,每個 TShell 由一系列的 Face 組成,每個 TWire 由一系列的 Edge 組成,每個 Tedge 由一系列的 Vertex 組成。當然,不是隨便就可以組成的,還是有要求的,比如: Face 組成 Tshell 要求 Face 的邊境相連等。
上述的聲明和實現(xiàn)主要在 TopoDS package 中。
上述 TopoDS_T* 類,主要是上面顯示的兩種屬性。具體的幾何數(shù)據(jù)和拓樸數(shù)據(jù)由 BREP 層實現(xiàn)。
BREP 層描述了一個 Boundary??Representation Data???Structure ,并通過繼承 TopoDS 層的類,添加了幾何信息。從上可以看出,有三個主要的實現(xiàn)類:
Brep_Tvertex 、 Brep_Tedge 、 Brep_Tface 類。
先從簡單的 Brep_Tvertex 類說起。 Tvertex 表示一個節(jié)點拓樸對象,包含了一個 3D 點信息和一個 Tolerance 信息,如下:
gp_Pnt myPnt;
Standard_Real myTolerance;
BRep_ListOfPointRepresentation myPoints;
第三個屬性目前似乎沒有使用。
再看 Brep_Tedge 類,改類比較復雜,看 OCCT 的文檔說明:
The TEdge from BRep is??inherited from??the??Tedge from TopoDS. It contains the geometric data ,The TEdge contains :
???????* A tolerance.
???????* A same parameter flag.
???????* A same range flag.
???????* A Degenerated flag.
???????*??A??list???of curve representation.
?
屬性如下:
Standard_Real myTolerance;
Standard_Integer myFlags;
BRep_ListOfCurveRepresentation myCurves;
其中,比較復雜的是 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 parametric space. 參數(shù)曲線
????* A curve on closed surface, two curves in parametric space. 例如圓柱的邊。
?
????--??Polygonal representations : 剖分后的數(shù)據(jù)。
????* A 3d polygon (at most one).
????* A Polygon on triangulation (array of node indices)
????* A Polygon on closed triangulation (2 arrays of node indices)
????* A polygon on surface (array of 2d points in parametric space)
?
???
????--??Curve on 2 surfaces :
????* This is used for storing shape continuity.
??足夠的復雜了。下面看一些 list 中可能有那些類:
BRep_CurveRepresentation??????
―― BRep_PolygonOnTriangulation
―――― BRep_PolygonOnClosedTriangulation??????
―― BRep_PolygonOnSurface
―――― BRep_PolygonOnClosedSurface??????
―― BRep_Polygon3D????
―― BRep_GCurve
―――― BRep_Curve3D??????
―――― BRep_CurveOnSurface????
―――――― BRep_CurveOnClosedSurface
―― BRep_CurveOn2Surfaces?
這些類很多,后面再詳細補充,主要關(guān)注如下類:
Gcurve 類:表示是幾何曲線類,可能是 3D 曲線( Curve3D ),也可能是參數(shù)曲線( CurveOnSurface 類),而參數(shù)曲線可能是閉合曲線的參數(shù)曲線( CurveOnClosedSurface 類)。
裁剪曲面中,裁剪環(huán)中的裁剪曲線,就是使用 CurveOnSurface 表示的。
通常,如果一條曲線是單獨的 3D 曲線,則 listofcurve 中通常只包含 Curve3d 。如果一個曲線是一個裁剪曲線,則通常包括一條 3d 曲線和一個參數(shù)曲線。當所在曲面進行了剖分后,則還會有對于的 polygon 數(shù)據(jù)。這也是為什么使用 list 記錄這些信息的原因。
先到這里,下面看 Tface 。
先看 OCCT 文檔說明:
The TFace contains :
???????* 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????optional Triangulation.???If??there??is a triangulation the surface can be absent.
???????*??The??Location is??used???for the Surface.
???????*???The triangulation??is in the same reference system ??than the TFace.?????A point on mySurface must???be transformed with myLocation,??but??not a point??on the triangulation.
???????*???The Surface may??be shared by different TFaces but not the??Triangulation, because the??Triangulation may be modified by??the edges.
?
?
Tface 包括如下屬性:
Handle_Geom_Surface mySurface; 關(guān)聯(lián)的 geom 層的曲面信息,這個曲面可能是無界曲面,例如: Plane 。
Handle_Poly_Triangulation myTriangulation; Face 網(wǎng)格剖分后生成的網(wǎng)格數(shù)據(jù)。主要用于顯示時使用。
TopLoc_Location myLocation; 曲面的位置信息,為了便于同一個曲面在不同位置顯示時的數(shù)據(jù)共享。
Standard_Real myTolerance; 曲面的誤差。
Standard_Boolean myNaturalRestriction; 是否自然參數(shù)限制的曲面,當是自然限制時,曲面被矩形參數(shù)區(qū)域[U1,U2] × [V1,V2] 限制,否則,為裁剪曲線限制,參數(shù)裁剪區(qū)域通常不是規(guī)則的矩形區(qū)域。
?
通常,一個裁剪曲面 Tface ,除包含上述信息外,還會包含一系列的 Wire 子 shape ,這些 wire 構(gòu)成了 Tface 的多個裁剪環(huán),其中一個為外環(huán), 0 個或多個內(nèi)環(huán)。
總結(jié)
- 上一篇: LDT
- 下一篇: 利用IPSec/L2TP代理上网