首页/文章/ 详情

Face的拓扑信息

1年前浏览1073

在《拓扑》一文中,拓扑定义了"围成"和“一部分的”概念。拓扑几何中,面(Face)是由闭合的线(wire)围成的。闭合的线,是由一系列边(Edge)按首尾连接组成的。边是由顶点(Vertex)围成的。

本文我们以球面为例子,尝试解析拓扑面的信息。

1. 球面详细信息

以下给出使用OCC的“Draw Test Harness”模块,给出球面的详细信息。






















































































































Dump of 7 TShapes
-----------------
Flags : Free, Modified, Checked, Orientable, Closed, Infinite, Convex, Locked
TShape # 1 : FACE      11010000 00000171D02146E0    +2NaturalRestriction    Tolerance : 1e-07    - Surface : 1
TShape # 2 : WIRE      01011000 00000171C94249D0    -5 +4 +5 -3
TShape # 3 : EDGE      01010000 00000171C9B70160    +6 -6    Tolerance : 1e-07     same parametrisation of curves     same range on curves     degenerated    - PCurve : 4 on surface 1, range : 0 6.28318530717959  UV Points : 0, 1.5707963267949 6.28318530717959, 1.5707963267949
TShape # 4 : EDGE      01010000 00000171C9B70960    +7 -7    Tolerance : 1e-07     same parametrisation of curves     same range on curves     degenerated    - PCurve : 3 on surface 1, range : 0 6.28318530717959  UV Points : 0, -1.5707963267949 6.28318530717959, -1.5707963267949
TShape # 5 : EDGE      01010000 00000171C9B70DE0    +7 -6    Tolerance : 1e-07     same parametrisation of curves     same range on curves    - Curve 3D : 1, range : -1.5707963267949 1.5707963267949    - PCurve : 1, 2 (C0) on surface 1, range : -1.5707963267949 1.5707963267949  UV Points : 6.28318530717959, -1.5707963267949 6.28318530717959, 1.5707963267949  UV Points : 0, -1.5707963267949 0, 1.5707963267949
TShape # 6 : VERTEX    01011010 00000171D02F1900
   Tolerance : 1e-07    - Point 3D : 1.22464679914735e-15, 0, 20
TShape # 7 : VERTEX    01011010 00000171D02F2290
   Tolerance : 1e-07    - Point 3D : 1.22464679914735e-15, 0, -20

-------Dump of 4 Curve2ds -------
  1 : Line  Origin :6.28318530717959, 0  Axis   :0, 1
  2 : Line  Origin :0, 0  Axis   :0, 1
  3 : Line  Origin :0, -1.5707963267949  Axis   :1, 0
  4 : Line  Origin :0, 1.5707963267949  Axis   :1, 0

-------Dump of 1 Curves -------
  1 : Trimmed curveParameters : 4.71238898038469 7.85398163397448Basis curve :Circle  Center :0, 0, 0  Axis   :0, -1, 0  XAxis  :1, 0, 0  YAxis  :-0, 0, 1  Radius :20
-------Dump of 0 Polygon3Ds ------- -------Dump of 0 PolygonOnTriangulations -------
-------Dump of 1 surfaces -------
  1 : SphericalSurface  Center :0, 0, 0  Axis   :0, 0, 1  XAxis  :1, 0, -0  YAxis  :-0, 1, 0  Radius :20
-------Dump of 0 Triangulations -------


------- Dump of 0 Locations -------

详细的图示解析:

  • 球面包含 7 TShapes。TShape代表了拓扑底层几何表示。其数据结构大致如下,应该有4条Edge,但是Draw的dump命令,只打印出三条边

  • 四条Edge分别对应四条PCurve。具体信息在,“Dump of 4 Curve2ds”。

  • Face对应一个球面几何“SphericalSurface”。

关于如何遍历访问,Face下的信息,此处不再赘述。

由此我们得出,任何曲面都是由闭合Wire围成,即使其存在退化边、缝合边。

2. Face的参数平面

三维任意曲面,都对应二维参数平面上的几何。求二维参数平面的方法为:

  • 获得Face的所有Wire

  • 判断那些Wire是外边界,那些是内边界;判断方法是比较wire所围成区域的面积,面积最大者为外边界,其余都是内边界

  • 获取wire的edge对应的PCurve,将PCurve首尾连接,形成新的二维平面。

  • 做布尔操作。


此处要注意获得的Wire是不是正确,详细见第3节。代码太长,此处仅给出关键步骤。





















//读入igs文件,  IGESControl_Reader reader;//  TopExp_Explorer aWireExp(face, TopAbs_WIRE);  for (aWireExp; aWireExp.More(); aWireExp.Next()) {      //将wire存入容器  }  //找到外界  GProp_GProps areaPro1;  TopoDS_Face proFace1 = BRepBuilderAPI_MakeFace(w);  BRepGProp::SurfaceProperties(proFace1, areaPro1);  Standard_Real area1 = areaPro1.Mass();//得到面积,面积最大者是外边界    //获取每条Wire对应Edge的PCurve  TopExp_Explore wireE(wire,TopAbs_Edge);  Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(aTempEdge, face, aPFirst, aPLast);  //形成平面    //布尔操作  BRepAlgoAPI_Cut cut(face2d, aNewHoleFace);

结果如下:

3. Wire的检查与修复

在求Face对应的参数平面的时,出现了以下状况。当获取到内孔的wire的PCurve,二维wire形成了错误的Face。如下:

起初以为是容差原因,调了容差后没有影响。使用ShapeAnalysis_Wire 提供的方法,检查。发现是edge的Order出错,使用ShapeFix_Wire::FixReorder() 修复后正常。



























    ShapeAnalysis_Wire aCheckWire(aNewWire, aNewFace, aPrecision);    // create a tool and load objects into it    if (aCheckWire.CheckOrder())    {      std::cout << "Some edges in the wire need to be reordered\n"        << "Please ensure that all the edges are correctly ordered before further analysis\n";      //修复          Standard_Real aPrecision = 1e-04;           ShapeFix_Wire aFixWire(theWire, aNewFace, aPrecision);           aFixWire.FixReorder();           TopoDS_Wire aNewWire = aFixWire.Wire();          }    if (aCheckWire.CheckSmall(aPrecision))    {      std::cout << "Wire contains edge(s) shorter than " << aPrecision << std::endl;    }    if (aCheckWire.CheckConnected())    {      std::cout << "Wire is disconnected\n";    }    if (aCheckWire.CheckSelfIntersection())    {      std::cout << "Wire has self-intersecting or intersecting adjacent edges\n";    }

有了准确的参数平面之后,就可以参数法剖分任意曲面,任意实体的表面。

参考:

OCC Online Documentation

来源:有限元术
曲面Origin
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2023-09-02
最近编辑:1年前
寒江雪_123
硕士 | cae工程师 签名征集中
获赞 48粉丝 102文章 49课程 9
点赞
收藏
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习 福利任务 兑换礼品
下载APP
联系我们
帮助与反馈