巷道三维可视化建模技术——以东滩煤矿为例.pdf
分类号分类号 TP391 密密 级级 公公 开开 U DC 单位代码单位代码 10424 学学 位位 论论 文文 巷道三维可视化建模技术巷道三维可视化建模技术 以东滩煤矿为例以东滩煤矿为例 石石 奉奉 华华 申请学位级别申请学位级别硕士学位硕士学位 专业名称地图制图与地理信息工程专业名称地图制图与地理信息工程 指导教师姓名指导教师姓名刘刘 冰冰 职职业名业名称称 副副 教教 授授 山山 东东 科科 技技 大大 学学 二零零七年四月二零零七年四月 论文题目论文题目 巷道三维可视化建模技术巷道三维可视化建模技术 以东滩煤矿为例以东滩煤矿为例 作者姓名石作者姓名石 奉奉 华华 入学时间入学时间 2004 年年 9 月月 专业名称专业名称地图制图与地图制图与 研究方向研究方向空间信息可视化空间信息可视化 地理信息工程地理信息工程 与虚拟现实技术与虚拟现实技术 指导教师指导教师 刘刘 冰冰 职职 称称 副副 教教 授授 论文提交日期论文提交日期2007 年年 4 月月 论文答辩日期论文答辩日期2007 年年 6 月月 授予学位日期授予学位日期 THREE-DIMENSIONAL VISUALIZATION MODELING OF MINE TUNNEL -----TAKE DONGTAN MINE FOR EXAMPLE A Dissertation ted in fulfillment of the requirements of the degree of MASTER OF ENGINEERING from Shandong University of Science and Technology by Shi Fenghua Supervisor Liu Bing Associate Professor College of Erath Ination Science and Engineering April 2007 声声 明明 本人呈交给山东科技大学的这篇硕士学位论文,除了所列参考文献和世所公认 的文献外,全部是本人在导师指导下的研究成果。该论文资料尚没有呈交于其它 任何学术机关作鉴定。 本人呈交给山东科技大学的这篇硕士学位论文,除了所列参考文献和世所公认 的文献外,全部是本人在导师指导下的研究成果。该论文资料尚没有呈交于其它 任何学术机关作鉴定。 硕士生签名硕士生签名 日日 期期 AFFIRMATION I declare that this dissertation, ted in fulfillment of the requirements for the award of Master in Shandong University of Science and Technology, is wholly my own work unless referenced of acknowledge. The document has not been ted for qualification at any other academic institute. Signature Date 山东科技大学硕士学位论文摘要 摘摘 要要 煤炭是我国的第一能源, 在一次性能源结构中占 72以上, 随着我国经济体制改革的 不断深入,现代化进程的不断加快,煤矿生产必将改变目前的人海战术,以现代化的管 理和生产技术展现于世人面前。 地下巷道作为煤矿中最重要的空间要素,在数字矿山建设中占有非常重要的位置。 将 巷道布置等进行三维仿真显示,能使矿山的开采活动数字化、可视化,及时、准确地记 录和表现井巷工程的变迁,可以提高矿山的管理水平及工作效率,改善矿山环境及安全 设计,对指导矿山开采设计与工程施工等具有重要意义。 本文首先分析了巷道三维可视化建模国内外研究现状, 然后详尽地对比了 visual C 与其它开发语言 VC、Java 等相比的优点与不足,同时也比较了 DirectX 与 OpenGL 的优 劣,最后作者采用 visual C# 2005 与 DirectX9.0c 结合,根据三维游戏中的三维场景 模拟,精灵运动的思想对巷道三维可视化模拟进行研究。 以山东东滩巷道数据资料为基础,结合矿山巷道数据的特点以及选择三维数据模型 的原则,从数据组织到数据提取,总结出了巷道节点和巷道体的三维数据结构。论文设 计了巷道三维可视化建模系统的总体结构图,在三维图形可视化分析理论的基础上成功 的建立了巷道三维可视化建模系统 (1) 完成了巷道数据的导入以及数据管理如添加、删除、查询等功能。 (2) 实现了巷道由点-线-面-单个巷道-多个巷道的过渡。 (3) 解决了巷道模拟过程中巷道连接点处的错切与重叠。为巷道漫游做准备。 (4) 方向光和聚光灯的运用以及纹理的映射使得巷道的模拟更加具有真实感。 (5) 可以任意切换进行巷道外部分析与内部漫游,用户可以单选或组合选择显示 巷道中线、巷道名称、巷道体、视点位置、巷道漫游以及显示数据信息。 (6) 可以运用鼠标、 键盘或工具栏按钮实现人机交互进行一定的可视化分析包括 放大、缩小、平移、旋转、外部与内部的漫游、纹理贴图、背景颜色替换等, 方便观察者从不同的角度进行观察。 (7) 巷道内部漫游主要是沿着巷道中线进行漫游,可以实时的了解视点的位置, 还可以在巷道内实现前进、倒退、巷道切换等功能,并有简单的碰撞检测。 (8) 图形的导出可为观察者提供满意的图像,方便以后的备案。 关键词关键词三维可视化,巷道,纹理,漫游,DirectX I 山东科技大学硕士学位论文摘要 Abstract Abstract Coal is the most dominant energy source in China and making up about 70 of total primary energy consumption in the country. With the deepening and accelerating the economic re, the current state of human waves will be replaced by the modern management and production technology in Coal Mine. As the most important spatial feature of coal, tunnel occupies very important position in Digital Mining DM in which 3D visualization of coal tunnel is the special application. If people can model the coal tunnel with 3D visualization, they will get the 3D graphics of tunnel and realize the digital and visualization of mining activities firstly; and secondly note and show the engineering changes in time and exactly; thirdly show the spatial relationships of excavation engineering and orebody, wall rock and even the surface diggings; finally improve the management and efficiency and also can improve mine design of safety and environmental. So 3D visualization of coal tunnel has great significance in mining Design and Construction In this paper, the author analyses the study status of tunnel 3D visualization at home and abroad firstly, then combine with the characteristic of tunnel data and the principle of choosing the 3D data model the author put forward some data structures about node and body of tunnel. After described the theory of 3D visualization in detail, the paper compares the advantage and disadvantage of Visual C with some other computer languages and also contrast the difference of DirectX and OpenGL and finally the author decides to use Visual C 2005 and DirectX to establish the system of 3D visualization of tunnel according to the idea of 3D games. Take the tunnel data of Dongtan mine of Shandong for example, the author designs the system architecture of the model of 3D visualization of tunnel and also sets up this system successfully which contains follows function 1Accepted loading and managing the tunnel data like Add, Delete, View, or II 山东科技大学硕士学位论文摘要 Modify. 2 Realized modeling the 3D tunnel order by the process of point→line →face→single tunnel→multi-tunnel. 3 Solved the problem of the join the tunnel at the junction. 4 Combined with the technology of texture mapping and light which contains directional light and spot light people will be personally on the scene of the tunnel 3D visualization. 5 Some visualization analyses like zoom in, zoom out, translation, rotation, roam in outsider or inner the tunnel, changing texture etc. 6 Can switch from analyzing the whole tunnel to roaming in the inner of tunnel or reverse freely, uses can decide to which features will be showing by single or together Mid-line of tunnel, Tunnel name, 3D tunnel, View position, Roaming in tunnel and Data ination. 7 Roaming in the inner of tunnel mainly is along with the midline of it, in this process people can know the view position exactly, not only this the user also can advance, back up or switch to other tunnel, in addition this system can realize some simple function of collision detection. 8 Through export the satisfying graphic, people can save and put it on records. Keywords Keywords 3D Visualization, Coal Tunnel, Texture, Roaming,DirectX III 山东科技大学硕士学位论文目录 目目 录录 1 绪论1 绪论 ....................................................................................................................1 1.1 引言..............................................................................................................................1 1.2 数字矿山......................................................................................................................2 1.3 巷道三维可视化建模国内外研究现状......................................................................5 1.4 东滩煤矿介绍..............................................................................................................8 1.5 论文主要研究内容....................................................................................................11 2 Visual C及DirectX介绍2 Visual C及DirectX介绍..............................................................................12 2.1 Visual C简介及其与其它语言的对比......................................................................12 2.2 DirectX简介及其与OpenGL的对比...........................................................................14 2.3 C与DirectX结合 ........................................................................................................18 3 巷道数据模型与数据结构的设计3 巷道数据模型与数据结构的设计..................................................................22 3.1 巷道建模的数据源....................................................................................................22 3.2 矿井巷道三维数据模型的研究................................................................................22 3.3 巷道的三维数据结构................................................................................................26 4 巷道三维建模4 巷道三维建模..................................................................................................30 4.1 三维图形生成步骤....................................................................................................30 4.2 巷道的截面模拟........................................................................................................32 4.3 单个巷道生成算法....................................................................................................34 4.4 巷道节点间的连接及算法实现................................................................................38 5 基于DirectX建立巷道三维可视化系统5 基于DirectX建立巷道三维可视化系统........................................................47 5.1 导入数据....................................................................................................................47 5.2 数据管理....................................................................................................................48 5.3 巷道建模....................................................................................................................49 I 山东科技大学硕士学位论文目录 5.4 图形可视化................................................................................................................50 5.5 图形输出....................................................................................................................74 6 结论与展望6 结论与展望......................................................................................................76 6.1 结论............................................................................................................................76 6.2 展望............................................................................................................................76 致致 谢谢 ..............................................................................................................78 参考文献参考文献 ..............................................................................................................79 发表论文发表论文 ..............................................................................................................82 II 山东科技大学硕士学位论文目录 Contents 1 Introduction............................................................................................................................1 1.1 Introduction........................................................................................................................................1 1.2 Digital Mining....................................................................................................................................2 1.3 Current research of tunnel 3D visualization at home and abroad.......................................................5 1.4 About Dongtan Coal Mine.................................................................................................................8 1.5 The main content of this paper......................................................................................................... 11 2 Visual C //公共类和数学结构 using Microsoft.DirectX.Direct3D; // 3D 图形和助手库 using Microsoft.DirectX.DirectSound; //声音支持 using Microsoft.DirectX.DirectPlay; //用于多玩家游戏的网络 API using Microsoft.DirectX.Direct; // 输入设备支持(例如,鼠标和游戏杆) using Microsoft.DirectX.AudioVideoPlayback; //播放视频和音频(例如,在 PC 上播放 DVD) using Microsoft.DirectX.Diagnostics; //疑难解答 using Microsoft.DirectX.Security; //访问安全性 using Microsoft.DirectX.Security.Permissions; //访问安全权限 using DIRECT3D Microsoft.DirectX.Direct3D; using DIRECTS Microsoft.DirectX.DirectSound; 2.3.2 C与 DirectX 结合 2.3.2 C与 DirectX 结合 (1)初始化D3D((1)初始化D3D(Initializing D3DInitializing D3D) ) public void InitializeGraphicsobject sender, EventArgs e { PresentParameters presentParams new PresentParameters; presentParams.Windowed true; presentParams.SwapEffect SwapEffect.Discard; device new Device 0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, presentParams; //创建新设备 vb new VertexBuffer typeof CustomVertex.PositionColored, 3, device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColored.at,Pool.Default; //创建顶点缓冲 vb.Created new EventHandlerOnVertexBufferCreate; OnVertexBufferCreatevb, null; } (2)照相机的放置SetupCamera (2)照相机的放置SetupCamera private void SetupCamera { device.RenderState.CullMode Cull.None; device.Trans.World Matrix.RotationAxisnew Vector3 angle / float Math.PI*2.0f , 19 山东科技大学硕士学位论文及介绍 Visual CDirectX angle/floatMath.PI*4.0f, angle/floatMath.PI*6.0f,angle/floatMath.PI; angle 0.1f; device.Trans.Projection Matrix.PerspectiveFovLHfloatMath.PI/4, this.Width/this.Height, 1.0f, 100.0f; //左手坐标系 device.Trans.View Matrix.LookAtLH new Vector30,0,5.0f, new Vector3, new Vector30,1,0; device.RenderState.Lighting false; //关闭光源 } 通常三维图形应用程序使用两种笛卡尔坐标系左手系和右手系。在这两种坐标系 中,正 x 轴指向右面,正 y 轴指向上面。通过沿正 x 轴方向到正 y 轴方向握拳,大姆指 的指向就是相应坐标系统的正 z 轴的指向。论文采用左手坐标系。图 2.3 显示了这两种 坐标系统。 左手坐标左手坐标系系 右手坐标右手坐标系系 图图 2.3 左右左右手坐标系手坐标系统统 Fig 2.3 Left- vs. right-handed coordinate systems (3)图形的绘制 (3)图形的绘制 protected override void OnPaintPaintEventArgs e { device.ClearClearFlags.Target,System.Drawing.Color.Aqua,1.0f,0; //清屏 SetupCamera; //设置照相机 device.BeginScene; device.Vertexat CustomVertex.PositionColored.at; device.SetStreamSource0,vb,0; device.DrawPrimitivesPrimitiveType.PointList,0,6; //画点表是一个顶点的集合,被渲染为孤立的点。 device.DrawPrimitivesPrimitiveType.LineList,0,3; //画线表线表是一个孤立线段的集合。 device.DrawPrimitivesPrimitiveType.LineStrip,0,5; 20 山东科技大学硕士学位论文及介绍 Visual CDirectX //画线带 线带是由相互连接的线段组成的图元。 device.DrawPrimitivesPrimitiveType.TriangleList,0,2; //画三角形表 三角形表是一个孤立三角形的集合。 device.DrawPrimitivesPrimitiveType.TriangleStrip,0,4; //画三角形带 三角形带是一系列相连的三角形。 device.DrawPrimitivesPrimitiveType.TriangleFan,0,3; //画三角形扇 device.EndScene; device.Present; this.Invalidate; //重绘窗口 } 21 山东科技大学硕士学位论文巷道数据模型与数据结构的设计 3 巷道数据模型与数据结构的设计 3 巷道数据模型与数据结构的设计 数据建模是指把现实世界的数据组织为有用且能反映真实信息的数据集的过程。根 据一定的方案建立的数据逻辑组织方式叫数据模型。 数据建模过程可以分为三步 首先, 选择一种数据模型来对现实世界的数据进行组织;然后,选择一种数据结构来表达该数 据模型;最后,选择一种适合于记录该数据结构的文件格式[22]。 矿山信息系统主要面对两类空间目标,即掘进巷道和地层,因此矿井掘进巷道是矿 山信息系统研究的重要内容之一。巷道是采矿生产中将煤炭从工作面运送到地面,以及 通风、安全输送工人的通道。对整个矿井而言,巷道是其核心部分。在矿井巷道的掘进 过程中,测量数据始终起着重要的指导作用,并伴随着这一活动全过程。生成采掘工程 平面图的原始数据为导线测量点,也就是说,无论采掘图的比例尺如何变化,它的原始 数据的空间分布结构是不变化的,巷道间的空间分布及相互关系(如平面相交、空间相 交、T 字型相交等等)是固定的。事实上,测量信息记录了矿井巷道的延伸过程。这一 思想对矿井巷道模型的建立至关重要。 3.1 巷道建模的数据源 3.1 巷道建模的数据源 分析巷道自身的特点就不难发现哪些数据对巷道模型有用, 巷道相对来说空间区域 不算大, 简单的理解为由长、宽、高组成的一个体域, 不过它的长度随着布置在其内的 导线的延伸而延伸, 有的巷道是在岩层中开挖的, 有的是在煤层中开挖的, 这就决定了 巷道的纹理特征。井下的每一条巷道都布置有中线点, 点的坐标又是三维坐标, 因而巷 道内的中线点是建立三维巷道的基础数据[36]。如果把巷道抽象成一条线, 这条线就是巷 道中线,巷道的用处不同, 其截面的形状、 宽度、 高度也不一样, 所以用以描述巷道截面 的数据也是建立巷道模型的一项数据源。 3.2 矿井巷道三维数据模型的研究 3.2 矿井巷道三维数据模型的研究 3.2.1 矿井巷道数据特点 3.2.1 矿井巷道数据特点 根据实际情况,这里我们只研究矿井巷道数据的特点 22 山东科技大学硕士学位论文巷道数据模型与数据结构的设计 (1) 一般而言,掘进巷道的数据主要来源于矿山设计和测绘工程,并且这些测量信息 也是更重要、最准确的信息来源; (2) 测量点的布设随着巷道的掘进逐渐进行,自始自终沿着巷道,因此测量导线简单 勾画出了井下巷道的拓扑关系; (3) 井下测量随着巷道的掘进逐渐顺序进行,导线测量过程中,容易对巷道特征点和 巷道附属物进