## OpenCASCADE Hidden Line Removal 原

eryar

Abstract. To provide the precision required in industrial design, drawings need to offer the possibility of removing lines, which are hidden in a given projection. OpenCASCADE provides two algorithms for this Hidden Line Removal component. The paper mainly translate the document of OpenCASCADE Modeling Algorithms, and give some applications in the plant design CAD software.

Key Words. OpenCASCADE, HLR, Hidden Line Removal

1. Introduction

Figure 1.1 Drawing generated from 3D model by PDMS

v 物体A在物体B的后面；

v 物体A与物体B在投影平面上有重叠部分；

HLRBRep_Algo是根据模型来计算的一种高精度的算法，而 HLRBRep_PolyAlgo是基于离散数据的算法。当使用HLRBRep_Algo时可以得到精确结果，而使用HLRBRep_PolyAlgo可 以提高计算速度。他们两个算法都可以处理任意类型的模型，如组合体、面或线，但也有些约束，如下情况就未被处理：

v 点未被处理；

v Z平面上没有被裁剪；

v 无限面或线没有处理；

Figure 1.2 Sharp, smooth and sewn edges in a simple screw shape

Figure 1.3 Outline edges and isoparameters in the same shape

Figure 1.4 An extraction showing hidden sharp edges

2.HLR Usage

2.2 Setting View Parameters

2.3 Computing the Projections

2.4 Extracting Edges

v Visible/hidden sharp edges;

v Visible/hidden smooth edges;

v Visible/hidden sewn edges;

v Visible/hidden outline edges;

3.Examples

``````osg::Node* TestPolyHlr(void)
{
osg::ref_ptr<osg::Geode> aGeode = new osg::Geode();
osg::ref_ptr<osg::Geometry> aLineGeometry = new osg::Geometry();
osg::ref_ptr<osg::Vec3Array> aVertices = new osg::Vec3Array();

TopoDS_Shape aPipeModel;

BRepMesh_IncrementalMesh aMesher(aPipeModel, 0.1);

OSD_Timer aTimer;
aTimer.Start();

Handle_HLRBRep_PolyAlgo aHlrPolyAlgo = new HLRBRep_PolyAlgo();

HLRAlgo_Projector aProjector;
HLRBRep_PolyHLRToShape aHlr2Shape;

aHlrPolyAlgo->Projector(aProjector);
aHlrPolyAlgo->Update();

aHlr2Shape.Update(aHlrPolyAlgo);

aTimer.Stop();
aTimer.Show(std::cout); for (TopExp_Explorer e(aHlr2Shape.VCompound(), TopAbs_EDGE); e.More(); e.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(e.Current());
TopoDS_Vertex aFirstVertex = TopExp::FirstVertex(anEdge);
TopoDS_Vertex aLastVertex = TopExp::LastVertex(anEdge);
gp_Pnt aFirstPoint = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aLastPoint = BRep_Tool::Pnt(aLastVertex);

aVertices->push_back(osg::Vec3(aFirstPoint.X(), aFirstPoint.Y(), aFirstPoint.Z()));
aVertices->push_back(osg::Vec3(aLastPoint.X(), aLastPoint.Y(), aLastPoint.Z()));
} for (TopExp_Explorer e(aHlr2Shape.OutLineVCompound(), TopAbs_EDGE); e.More(); e.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(e.Current());
TopoDS_Vertex aFirstVertex = TopExp::FirstVertex(anEdge);
TopoDS_Vertex aLastVertex = TopExp::LastVertex(anEdge);
gp_Pnt aFirstPoint = BRep_Tool::Pnt(aFirstVertex);
gp_Pnt aLastPoint = BRep_Tool::Pnt(aLastVertex);

aVertices->push_back(osg::Vec3(aFirstPoint.X(), aFirstPoint.Y(), aFirstPoint.Z()));
aVertices->push_back(osg::Vec3(aLastPoint.X(), aLastPoint.Y(), aLastPoint.Z()));
}

aLineGeometry->setVertexArray(aVertices);

}``````

Figure 3.1 HLR for pipe model

Figure 3.2 HLR pipe model in OpenSceneGraph

Figure 3.3 HLR time usage

Figure 3.4 HLR pipe model in less tesslate precision

Figure 3.5 HLR pipe model in less tesslate precision time usage

4.Conclusion

5. References

1. OpenCASCADE Modeling Algorithms User Guide6.8.0 2014

2. 何援军. 计算机图形学. 机械工业出版社. 2010

3. 孙家广. 计算机图形学. 清华大学出版社. 2000

### eryar

oschina
2016/04/21
3K
2

OpenCASCADE Make Primitives-Box eryar@163.com Abstract. By making a simple box to demonstrate the BRep data structure of the OpenCASCADE. The construction method is different fr......

eryar
2014/11/23
243
0
Building OpenCascade on Windows with Visual Studio

eryar
2013/09/23
519
0

chenchenxixi
2012/07/09
1K
2

2016/10/10
2.3K
3

2分钟前
0
0
Python学习10.14：Python set集合详解

Python 中的集合，和数学中的集合概念一样，用来保存不重复的元素，即集合中的元素都是唯一的，互不相同。 从形式上看，和字典类似，Python 集合会将所有元素放在一对大括号 {} 中，相邻元素...

2分钟前
0
0

2分钟前
0
0
75.nosql memcached与安装及查看状态

21.1 nosql介绍 21.2 memrcached介绍 21.3 安装memcached 21.4 查看memcachedq状态 21.1 nosql介绍 什么是NoSQL： 1.非关系型数据库就是NoSQL，关系型数据库代表MySQL 也是一种数据库，来存储...

oschina130111
4分钟前
0
0

4分钟前
1
0