Opennurbs Boundary Representation Oritation

Opennurbs Brep Data Structure figure1

在Opennurbs数据结构里的 m_Reversed flag 共计4处,

  1. Edge 和 Curve3d 之间的 m_bReversed
  2. Trim 和 Curve2d 之间的 m_bReversed
  3. Trim 和 Edge 之间的 m_bRev3d
  4. Face 和 Surface 之间的 m_bRev

Opennurbs Brep 类视图
figure2

Brep Loop & Edge DirectionsBrep Loop & Edge Diections
Opennurbs Brep几何拓扑间的Oritation关系:
一: Edge HalfEdge Curve3d pCurve 的关系:

			flag:
					                 Edge.m_bReversed
					Edge ----------------------------------Curve3d
					   |
					   |
					   |
					   |  Trim.m_bRev3d 
					   |
					   |   
					   |             Trim.m_bReversed 
					Trim------------------------------------Curve2d
  1. Geom Direction:
    Curve Tangent Direction, Surface Normal

  2. Topo Oritation:
    Trim Oritation: Curve2d Direction+ m_bReversed
    Edge Oritation : Curve3d Direction+ m_bReversed
    Face Oritation: Surface Normal + m_bRev

  3. m_bRev3d :
    2d trim and 3d edge have opposite orientations.

  4. m_bRev :
    the face orientation is opposite of natural surface orientation.

  5. m_Vi[2]:
    m_Vi[0] is the Edge Start, not the Curve start

二: Loop走向 和 Face.m_bRev 的关系:

             Loop's CCW: 
					    ---------------<<<-------------------
					   |                                    |
					   |									|
					   |									|
					  \\|/  				Loop2d			   /|\\
					   |									|
					   |   									|
					   |                    				|
					   ------------------>>>-----------------
				 outer Loop2d always counter-clockwise on paramter space
   It means, outer Loop3d's CCW always same with surface normal,no depends on Face.m_bRev

loop oritation :outer loops are always oriented counter-clockwise on paramter space, in other words ,the 3d outer loop walks along surface normal, not the face orientation .

I will prove this from three points:

  1. In the figure Opennurbs Brep Data Structure ,you can see the out loop oriented counter-clockwise on 2D Paramter Space, although the Face.m_bRev is true.
  2. In the figure Brep Loop & Edge Directions, you can get outer loops are oriented counter-clockwise
  3. Construct a cube with Rhino and Read the 3dm file with Opennurbs. where the first Face is Bottom Face : surface normal is up, but Face Oritation is down . From the debug data, you also can get outer loops are oriented counter-clockwise
OpenNURBS Archive File:  D:\\shape.3dm
        Successfully read.
ON_Brep:
surfaces:  6
3d curve:  12
2d curves: 24
vertices:  8
edges:     12
trims:     24
loops:     6
faces:     6
curve2d[ 0]: ON_NurbsCurve domain(0,10) start(0,0) end(10,0)
curve2d[ 1]: ON_NurbsCurve domain(0,10) start(10,0) end(10,10)
curve2d[ 2]: ON_NurbsCurve domain(10,20) start(0,10) end(0,0)
curve2d[ 3]: ON_NurbsCurve domain(10,20) start(10,0) end(20,0)
curve2d[ 4]: ON_NurbsCurve domain(0,10) start(20,0) end(20,10)
curve2d[ 5]: ON_NurbsCurve domain(10,20) start(10,10) end(10,0)
curve2d[ 6]: ON_NurbsCurve domain(20,30) start(20,0) end(30,0)
curve2d[ 7]: ON_NurbsCurve domain(0,10) start(30,0) end(30,10)
curve2d[ 8]: ON_NurbsCurve domain(10,20) start(20,10) end(20,0)
curve2d[ 9]: ON_NurbsCurve domain(30,40) start(30,0) end(40,0)
curve2d[10]: ON_NurbsCurve domain(0,10) start(40,0) end(40,10)
curve2d[11]: ON_NurbsCurve domain(10,20) start(30,10) end(30,0)
curve2d[12]: ON_NurbsCurve domain(0,10) start(0,0) end(10,0)
curve2d[13]: ON_NurbsCurve domain(10,20) start(10,0) end(10,10)
curve2d[14]: ON_NurbsCurve domain(20,30) start(10,10) end(0,10)
curve2d[15]: ON_NurbsCurve domain(30,40) start(0,10) end(0,0)
curve2d[16]: ON_NurbsCurve domain(-10,-0) start(10,10) end(0,10)
curve2d[17]: ON_NurbsCurve domain(0,10) start(0,5) end(10,5)
curve2d[18]: ON_NurbsCurve domain(-15,-5) start(20,10) end(10,10)
curve2d[19]: ON_NurbsCurve domain(5,15) start(10,5) end(10,15)
curve2d[20]: ON_NurbsCurve domain(-30,-20) start(30,10) end(20,10)
curve2d[21]: ON_NurbsCurve domain(20,30) start(10,15) end(0,15)
curve2d[22]: ON_NurbsCurve domain(-75,-65) start(40,10) end(30,10)
curve2d[23]: ON_NurbsCurve domain(65,75) start(0,15) end(0,5)
curve3d[ 0]: ON_NurbsCurve domain(0,10) start(0,0,0) end(10,0,0)
curve3d[ 1]: ON_NurbsCurve domain(0,10) start(10,0,0) end(10,0,10)
curve3d[ 2]: ON_NurbsCurve domain(0,10) start(0,0,0) end(0,0,10)
curve3d[ 3]: ON_NurbsCurve domain(10,20) start(10,0,0) end(10,10,0)
curve3d[ 4]: ON_NurbsCurve domain(0,10) start(10,10,0) end(10,10,10)
curve3d[ 5]: ON_NurbsCurve domain(20,30) start(10,10,0) end(0,10,0)
curve3d[ 6]: ON_NurbsCurve domain(0,10) start(0,10,0) end(0,10,10)
curve3d[ 7]: ON_NurbsCurve domain(30,40) start(0,10,0) end(0,0,0)
curve3d[ 8]: ON_NurbsCurve domain(0,10) start(0,0,10) end(10,0,10)
curve3d[ 9]: ON_NurbsCurve domain(5,15) start(10,0,10) end(10,10,10)
curve3d[10]: ON_NurbsCurve domain(20,30) start(10,10,10) end(0,10,10)
curve3d[11]: ON_NurbsCurve domain(65,75) start(0,10,10) end(0,0,10)
surface[ 0]: ON_PlaneSurface u(0,10) v(0,10)
surface[ 1]: ON_PlaneSurface u(0,20) v(0,20)
surface[ 2]: ON_NurbsSurface u(0,10) v(0,20)
surface[ 3]: ON_NurbsSurface u(10,20) v(0,20)
surface[ 4]: ON_NurbsSurface u(20,30) v(0,20)
surface[ 5]: ON_NurbsSurface u(30,40) v(0,20)
vertex[ 0]: (0.000000 0.000000 0.000000) tolerance(0)
        edges (0,2,7)
vertex[ 1]: (10.000000 0.000000 0.000000) tolerance(0)
        edges (0,1,3)
vertex[ 2]: (10.000000 10.000000 0.000000) tolerance(0)
        edges (3,4,5)
vertex[ 3]: (0.000000 10.000000 0.000000) tolerance(0)
        edges (5,6,7)
vertex[ 4]: (0.000000 0.000000 10.000000) tolerance(0)
        edges (8,11,2)
vertex[ 5]: (10.000000 0.000000 10.000000) tolerance(0)
        edges (8,9,1)
vertex[ 6]: (10.000000 10.000000 10.000000) tolerance(0)
        edges (9,10,4)
vertex[ 7]: (0.000000 10.000000 10.000000) tolerance(0)
        edges (10,11,6)
edge[ 0]: v0( 0) v1( 1) 3d_curve(0) tolerance(0)
        domain(0,10) start(0,0,0) end(10,0,0)
        trims (+0,+12)
edge[ 1]: v0( 1) v1( 5) 3d_curve(1) tolerance(0)
        domain(0,10) start(10,0,0) end(10,0,10)
        trims (+1,-5)
edge[ 2]: v0( 0) v1( 4) 3d_curve(2) tolerance(0)
        domain(0,10) start(0,0,0) end(0,0,10)
        trims (-2,+10)
edge[ 3]: v0( 1) v1( 2) 3d_curve(3) tolerance(0)
        domain(10,20) start(10,0,0) end(10,10,0)
        trims (+3,+13)
edge[ 4]: v0( 2) v1( 6) 3d_curve(4) tolerance(0)
        domain(0,10) start(10,10,0) end(10,10,10)
        trims (+4,-8)
edge[ 5]: v0( 2) v1( 3) 3d_curve(5) tolerance(0)
        domain(20,30) start(10,10,0) end(0,10,0)
        trims (+6,+14)
edge[ 6]: v0( 3) v1( 7) 3d_curve(6) tolerance(0)
        domain(0,10) start(0,10,0) end(0,10,10)
        trims (+7,-11)
edge[ 7]: v0( 3) v1( 0) 3d_curve(7) tolerance(0)
        domain(30,40) start(0,10,0) end(0,0,0)
        trims (+9,+15)
edge[ 8]: v0( 4) v1( 5) 3d_curve(8) tolerance(0)
        domain(0,10) start(0,0,10) end(10,0,10)
        trims (-16,+17)
edge[ 9]: v0( 5) v1( 6) 3d_curve(9) tolerance(0)
        domain(5,15) start(10,0,10) end(10,10,10)
        trims (-18,+19)
edge[10]: v0( 6) v1( 7) 3d_curve(10) tolerance(0)
        domain(20,30) start(10,10,10) end(0,10,10)
        trims (-20,+21)
edge[11]: v0( 7) v1( 4) 3d_curve(11) tolerance(0)
        domain(65,75) start(0,10,10) end(0,0,10)
        trims (-22,+23)
face[ 0]: surface(0) reverse(1) loops(0)
        Render mesh: 1 polygons
        (Face geometry is the same as underlying surface.)
        loop[ 0]: type(outer) 4 trims(12,13,14,15)
                trim[12]: edge( 0) v0( 0) v1( 1) tolerance(0,0)
                        type(mated   -south side iso) rev3d(0) 2d_curve(12)
                        domain(0,10) start(0,0) end(10,0)
                        surface points start(0,0,0) end(10,0,0)
                trim[13]: edge( 3) v0( 1) v1( 2) tolerance(0,0)
                        type(mated   -east side iso) rev3d(0) 2d_curve(13)
                        domain(10,20) start(10,0) end(10,10)
                        surface points start(10,0,0) end(10,10,0)
                trim[14]: edge( 5) v0( 2) v1( 3) tolerance(0,0)
                        type(mated   -north side iso) rev3d(0) 2d_curve(14)
                        domain(20,30) start(10,10) end(0,10)
                        surface points start(10,10,0) end(0,10,0)
                trim[15]: edge( 7) v0( 3) v1( 0) tolerance(0,0)
                        type(mated   -west side iso) rev3d(0) 2d_curve(15)
                        domain(30,40) start(0,10) end(0,0)
                        surface points start(0,10,0) end(0,0,0)
face[ 1]: surface(1) reverse(0) loops(5)
        Render mesh: 1 polygons
        loop[ 5]: type(outer) 4 trims(17,19,21,23)
                trim[17]: edge( 8) v0( 4) v1( 5) tolerance(0,0)
                        type(mated   -v iso) rev3d(0) 2d_curve(17)
                        domain(0,10) start(0,5) end(10,5)
                        surface points start(0,0,10) end(10,0,10)
                trim[19]: edge( 9) v0( 5) v1( 6) tolerance(0,0)
                        type(mated   -u iso) rev3d(0) 2d_curve(19)
                        domain(5,15) start(10,5) end(10,15)
                        surface points start(10,0,10) end(10,10,10)
                trim[21]: edge(10) v0( 6) v1( 7) tolerance(0,0)
                        type(mated   -v iso) rev3d(0) 2d_curve(21)
                        domain(20,30) start(10,15) end(0,15)
                        surface points start(10,10,10) end(0,10,10)
                trim[23]: edge(11) v0( 7) v1( 4) tolerance(0,0)
                        type(mated   -west side iso) rev3d(0) 2d_curve(23)
                        domain(65,75) start(0,15) end(0,5)
                        surface points start(0,10,10) end(0,0,10)
face[ 2]: surface(2) reverse(0) loops(1)
        Render mesh: 1 polygons
        loop[ 1]: type(outer) 4 trims(2,0,1,16)
                trim[ 2]: edge( 2) v0( 4) v1( 0) tolerance(0,0)
                        type(mated   -west side iso) rev3d(1) 2d_curve(2)
                        domain(10,20) start(0,10) end(0,0)
                        surface points start(0,0,10) end(0,0,0)
                trim[ 0]: edge( 0) v0( 0) v1( 1) tolerance(0,0)
                        type(mated   -south side iso) rev3d(0) 2d_curve(0)
                        domain(0,10) start(0,0) end(10,0)
                        surface points start(0,0,0) end(10,0,0)
                trim[ 1]: edge( 1) v0( 1) v1( 5) tolerance(0,0)
                        type(mated   -east side iso) rev3d(0) 2d_curve(1)
                        domain(0,10) start(10,0) end(10,10)
                        surface points start(10,0,0) end(10,0,10)
                trim[16]: edge( 8) v0( 5) v1( 4) tolerance(0,0)
                        type(mated   -v iso) rev3d(1) 2d_curve(16)
                        domain(-10,-0) start(10,10) end(0,10)
                        surface points start(10,0,10) end(0,0,10)
face[ 3]: surface(3) reverse(0) loops(2)
        Render mesh: 1 polygons
        loop[ 2]: type(outer) 4 trims(5,3,4,18)
                trim[ 5]: edge( 1) v0( 5) v1( 1) tolerance(0,0)
                        type(mated   -west side iso) rev3d(1) 2d_curve(5)
                        domain(10,20) start(10,10) end(10,0)
                        surface points start(10,0,10) end(10,0,0)
                trim[ 3]: edge( 3) v0( 1) v1( 2) tolerance(0,0)
                        type(mated   -south side iso) rev3d(0) 2d_curve(3)
                        domain(10,20) start(10,0) end(20,0)
                        surface points start(10,0,0) end(10,10,0)
                trim[ 4]: edge( 4) v0( 2) v1( 6) tolerance(0,0)
                        type(mated   -east side iso) rev3d(0) 2d_curve(4)
                        domain(0,10) start(20,0) end(20,10)
                        surface points start(10,10,0) end(10,10,10)
                trim[18]: edge( 9) v0( 6) v1( 5) tolerance(0,0)
                        type(mated   -v iso) rev3d(1) 2d_curve(18)
                        domain(-15,-5) start(20,10) end(10,10)
                        surface points start(10,10,10) end(10,0,10)
face[ 4]: surface(4) reverse(0) loops(3)
        Render mesh: 1 polygons
        loop[ 3]: type(outer) 4 trims(8,6,7,20)
                trim[ 8]: edge( 4) v0( 6) v1( 2) tolerance(0,0)
                        type(mated   -west side iso) rev3d(1) 2d_curve(8)
                        domain(10,20) start(20,10) end(20,0)
                        surface points start(10,10,10) end(10,10,0)
                trim[ 6]: edge( 5) v0( 2) v1( 3) tolerance(0,0)
                        type(mated   -south side iso) rev3d(0) 2d_curve(6)
                        domain(20,30) start(20,0) end(30,0)
                        surface points start(10,10,0) end(0,10,0)
                trim[ 7]: edge( 6) v0( 3) v1( 7) tolerance(0,0)
                        type(mated   -east side iso) rev3d(0) 2d_curve(7)
                        domain(0,10) start(30,0) end(30,10)
                        surface points start(0,10,0) end(0,10,10)
                trim[20]: edge(10) v0( 7) v1( 6) tolerance(0,0)
                        type(mated   -v iso) rev3d(1) 2d_curve(20)
                        domain(-30,-20) start(30,10) end(20,10)
                        surface points start(0,10,10) end(10,10,10)
face[ 5]: surface(5) reverse(0) loops(4)
        Render mesh: 1 polygons
        loop[ 4]: type(outer) 4 trims(11,9,10,22)
                trim[11]: edge( 6) v0( 7) v1( 3) tolerance(0,0)
                        type(mated   -west side iso) rev3d(1) 2d_curve(11)
                        domain(10,20) start(30,10) end(30,0)
                        surface points start(0,10,10) end(0,10,0)
                trim[ 9]: edge( 7) v0( 3) v1( 0) tolerance(0,0)
                        type(mated   -south side iso) rev3d(0) 2d_curve(9)
                        domain(30,40) start(30,0) end(40,0)
                        surface points start(0,10,0) end(0,0,0)
                trim[10]: edge( 2) v0( 0) v1( 4) tolerance(0,0)
                        type(mated   -east side iso) rev3d(0) 2d_curve(10)
                        domain(0,10) start(40,0) end(40,10)
                        surface points start(0,0,0) end(0,0,10)
                trim[22]: edge(11) v0( 4) v1( 7) tolerance(0,0)
                        type(mated   -v iso) rev3d(1) 2d_curve(22)
                        domain(-75,-65) start(40,10) end(30,10)
                        surface points start(0,0,10) end(0,10,10)

Benefit of loop2d oritation === counter-clockwise:
1.可以共享,Opencascade里体现更为明显(拉伸体的上下 Face)
2.做布尔运算时可以不用翻转几何或者拓扑
5. 没有数据冗余,如果依赖m_bRev,相当于缓存冗余数据

关于Oritation的设计,OCCT的还有些不一样,看到一些解读OCCT Oritation的文章OCCT NOTE ,后面也会写一篇Shape.Oritation的文章,从不同角度。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容