论文(设计)一种基于OBB 包围盒算法的改进.doc

上传人:laozhun 文档编号:3928249 上传时间:2023-03-28 格式:DOC 页数:9 大小:308KB
返回 下载 相关 举报
论文(设计)一种基于OBB 包围盒算法的改进.doc_第1页
第1页 / 共9页
论文(设计)一种基于OBB 包围盒算法的改进.doc_第2页
第2页 / 共9页
论文(设计)一种基于OBB 包围盒算法的改进.doc_第3页
第3页 / 共9页
论文(设计)一种基于OBB 包围盒算法的改进.doc_第4页
第4页 / 共9页
论文(设计)一种基于OBB 包围盒算法的改进.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《论文(设计)一种基于OBB 包围盒算法的改进.doc》由会员分享,可在线阅读,更多相关《论文(设计)一种基于OBB 包围盒算法的改进.doc(9页珍藏版)》请在三一办公上搜索。

1、一种基于OBB包围盒算法的改进作者:耿朝阳 刘敏 邮政编码: 710032 陕西省西安市新城区金花北路四号 西安工业大学计算机科学与工程学院为了提高碰撞检测的速度,对虚拟环境中的物体进行了假设,提出了方向圆柱包围盒检测方法,并结合各类包围盒的特点,分析了不同类型包围盒之间算法,实现了层次包围盒碰撞检测算法的优化,提高了碰撞检测的速度,增强了系统的实时性。关键词:碰撞检测;虚拟环境;检测算法;方向圆柱包围盒In order to improve the efficiency of collision detection of the virtual objects in the environm

2、ent the hypothesis, and put forward the direction of cylindrical bounding box testing method, combining with the characteristics of all kinds of the bounding box, analyzes the different type between the bounding box algorithm, achieves the bounding box of collision detection algorithm optimization t

3、o improve the efficiency of collision detection, and enhance the system of real-time.Key words : Collision detection; virtual environment; detection algorithms; bounding box of direction cylindrical;1 碰撞检测的基本原理虚拟场景中的碰撞问题包括碰撞检测和碰撞响应两部分,碰撞检测的目标就是发现碰撞并报告,为进一步的碰撞响应提供必要的信息;碰撞响应是在碰撞发生后,根据碰撞点和其他参数使发生碰撞的对象做

4、出正确的动作,动态反映真实的效果。检测要求可按具体应用对精确性德要求分为精确检测和近似检测两类,通常为加快速度,首先利用近似检测将多数明显不相交的物体对进行快速排除,然后再对可能相交的物体进行一步检测。1) 检测是否有碰撞发生2) 检测碰撞发生的位置3) 检测物体间的距离4) 预测下一次碰撞的时间 2 碰撞检测算法分类及其比较碰撞检测领域中的算法种类繁多,各有侧重,不存在统一的分类标准。这里从两个角度对碰撞检测算法进行分类:一是从时间域的角度来分;二是从空间域的角度来分。2.1 基于时间域的检测算法 从时间域的角度来分,碰撞检测算法可分为离散碰撞检测算法和连续碰撞检测算法两类。离散碰撞检测算法

5、是指在时间轴的每个离散时刻t0,t1,tn上不断地检测场景中所有之间是否发生碰撞算法。由于算法的时间离散特性,这类算法至少存在以下两个问题:1)存在刺穿现象。当时间步长过大时,两个物体可能已发生了一定深度的刺穿才被检测到已发生碰撞,因此无法保证物体的运动真实性;2)会遗漏发生碰撞的情况。对于较狭窄的物体,当运动物体在相邻时间离散点的两个位置恰好处于该狭窄物体两侧时,离散算法将无法正确地检测出物体所发生的碰撞。 2.2 基于空间域的碰撞检测算法分类基于空间域的碰撞检测算法一直是人们研究的重点,目前已有相当多的研究成果。根据所采用结构的不同可将它们分为两类:空间剖分法和层次包围体法。其中,空间剖分

6、法是采用对整个场景的层次剖分技术来实现,而层次包围体法则是对场景中每个物体构建合理的层次包围体来实现。物体的层次包围盒检测方法是碰撞检测算法中广泛使用的一种方法。常见的包围体主要包括包围球、AABB、OBB包围盒。2.2.1 基于球形包围盒检测法的碰撞检测在虚拟场景中,两个不规则的运动物体之间将要发生碰撞时,可以采用球形包围盒检测法来进行检测,当碰撞发生时,采取相应措施,避免碰撞。其实现如图2.1首先动态拾取虚拟物体, 然后根据实际需要,为涉及到的每个虚拟对象创建球形包围盒。针对两个物体,获取两个球心之间的距离, 同时获取两个球体各自的半径。当检测条件具备时, 根据球形包围盒碰撞检测算法, 判

7、断两个物体是否发生了碰撞。如果发生了碰撞,将进行碰撞响应, 根据当前虚拟对象的特性, 采取不同的响应方式。 图2.1 球形包围盒2.2.2 基于坐标轴的包围盒轴向包围盒AABB是被定义为包含该对象各边平行于坐标轴的最小的六面体,是应用最早的包围盒。AABB可表示为: ( 2.1 )其中, , 分别是该AABB在X,Y,Z坐标轴上的投影的最小和最大坐标值。分别计算组成对象的图元集合中各个元素顶点的x坐标、y坐标和z坐标的最小值和最大值即可确定,因此描述一个AABB仅需六个标量。AABB间的相交测试相对比较简单,相交测试采用区间测试的方法。AABB包围盒分别是在三个分离轴上投影之后,在每个坐标轴采

8、用区间测试,可以确定两个AABB包围盒是否重叠。区间测试在每个轴上最多进行两次,每一对包围盒最多进行6次比较运算,即在每个轴上进行这样的比较:设A包围盒在X轴上的投影的最小值为,最大值为,B包围盒在X轴上的投影的最小值为 ,最大值,如果,那么A与B不相交,如果,那么A与B不相交。当且仅当两个AABB在三个坐标轴上的投影区间均重叠时,他们是相交的 图2.2 AABB包围盒AABB的优点是构造简单,相交测试容易,计算效率高,缺点是对物体的包围还不够紧致,紧密性较差,尤其是对于沿斜对角方向放置的瘦长形,故较适合用于物体在空间中分布稀疏的情况。2.2.3 方向包围盒(OBB)及其对它的改进 方向包围盒

9、即OBB(Oriented Bounding Box),是包含需检测对象并且每条边都不一定与坐标轴方向一致的最小长方体,它由Gottschalk于1996年提出。OBB与AABB最大的区别就是方向的任意性,可以随着对象的形状特点构造方向任意的长方体包围盒,因此OBB具有更好的紧致性。OBB包围盒是一个表面法线两两垂直的长方体,也就是说它是一个可以任意旋转的AABB。包围盒是一种非常有效的碰撞检测加速方法,基于OBB包围盒这里提出一种方向圆柱包围盒,用于固定了方向和位移的运动物体的碰撞检测。方向圆柱包围盒的构造方法是,首先选择需要拆装的零件的几何中心O=( ox, oy, oz )为顶点,拆装方

10、向=( vx, vy, vz )为方向(是单位向量),拆装距离d为长度,构造直线,其参数方程为: ( 2.2 )d取tmin处d+ tmax处OO 对于零件上的顶点P,设其在直线上的投影为,则到中心点O的距离为,遍历零件上的所有点,取最小值tmin和最大值tmax,参数区间 tmin, tmax就是零件上所有点在直线上的投影的参数区间。因此参考(2.1)可以给出有向线段的参数方程为: (tmin t d+ tmax ) ( 2.3)OuP有向线段表示零件在拆装运动过程中在直线上投影的范围,可以作为方向圆柱包围盒的轴线。下面求圆柱包围盒的半径。对于零件上的顶点P,则P到中心点O的向量为,点P到直

11、线的距离为u=。遍历零件上的所有点,取最大值umax即可作为圆柱包围盒的半径r。至此方向圆柱包围盒已经构造完成。对当前拆装零件测试的时候,首先将它的圆柱包围盒对其它各个零件进行相交测试,找出可能会发生碰撞的零件,然后再用当前拆装零件对这些零件进行精确相交测试。 这个前提下,给出圆柱包围盒碰撞的具体算法如下:1) 利用上面介绍的方法对当前拆装零件构造方向圆柱包围盒,设轴线为,半径为r,零件中心为O,其方程可用公式(2.2)表示;2) 遍历整个设备的其他零件,取得第i零件ai,(第一次进入的时候i= 0,以后每次进入该步骤的时候i自增1);3) 建立空列表集合Li;4) 遍历零件ai的所有顶点,取

12、得第j个点Pij,(第一次进入的时候j= 0,以后每次进入该步骤的时候j自增1);5) 对于点Pij,其到直线的距离为uj=,判断是否ujr,如果成立,则转到步骤6,否则转到步骤4;6) 将点Pij相连的三角形面片加入集合Li;7) 判断遍历零件ai的所有顶点是否已经结束,如果是则继续执行步骤8,否则转到步骤4;8) 遍历集合Li,将设备上所有三角形面片和其中每个三角形面片都投影到圆柱包围盒轴线的垂面上,进行精确相交测试。9) 判断遍历设备的所有零件是否已经结束,如果是则继续执行步骤10,否则转到步骤2;10) 算法结束。此算法的意图是求所有零件包含在方向圆柱包围盒中的部分,并将它们投影在圆柱

13、包围盒轴向的垂面上,与设备在其上面的投影进行相交测试。 2.2.4 算法的实验结果:实验环境采用PC计算机,实现了优化的层次包围盒碰撞检测算法。实验采用本文方向圆柱算法和原始算法(即直接运用 OBB 进行相交判断的算法)分别测试了两个场景碰撞检测的时间。图2.4 OBB和改进后的圆柱包围盒的碰撞检测效果对比不同类型的检测方法,它们之间的特性是不尽相同的。包围球和AABB的包围紧密程度不如灵活的方向包围盒OBB,OBB(Oriented Bounding Box,有向包围盒)本质上还是一个最贴近物体的长方体,只不过该长方体可以根据物体的一阶矩任意旋转。OBB比包围球和AABB更加逼近物体,能显著

14、减少包围体的个数。因此,在实际的测试中人们通常进行两个回合的碰撞相交检测,用包围球做第一回合的快速测试,基于Virtools中也多采取用包围球做快速的测试,用OBB进行第二回合的测试。第一回合的测试可以剔除大多数不可见或不必裁剪的物体,这样不必进行第二回合测试的几率就会大得多。AABB在碰撞检测中应用比较广泛,也是历史最久的方法。它具有一致的方向,构造方法比较简单,但紧密性较差,OBB的总体性能要优于AABB包围球,OBB包围盒法的基本思想是使用简单的几何体来代替复杂的千奇百怪的几何体,先对物体的包围盒进行粗略检测, 当包围盒相交时其包围的几何体才有可能相交,当包围盒不相交时其包围的几何体一定

15、不相交;这样可以排除大量不可能相交的几何体和几何部位,从而快速找到相交的几何部位,是虚拟现实,计算机仿真应用中的关键技术。改进后的方向圆柱包围盒,能比使用形状复杂的包围盒间测试的耗费降低, 方向圆柱包围盒的几何特性简单,尽量地减少了占用存储空间,而且对于此类包围盒之间的求交运算的复杂性也应该相对容易。方向圆柱包围盒的紧密性,决定包围体逼近物体的程度,包围盒包围物体越紧密,越能减少需方向圆柱包围盒能够更好的包围被测的物体撞检测的耗碰费大小与其所应用的物体对象之间有很大的关系,比如对两个几乎重合的同心球间的碰撞检测,在虚拟维修的过程中,对被拆的两个螺丝的碰撞的检测,方向圆柱包围盒的性能是最佳的。在

16、实际的情况下,包围盒的紧密性是最重要的,紧密性较差的包围盒通常很难找到包围盒不相交的情况,从而导致大量的包围盒重叠测试和基本几何元素间的相交测试。 3 总结方向圆柱包围盒继承了OBB包围盒的优点,在相交测试中它的紧密性好,能比较显著地减少包围体的个数,当一些类似于圆柱的几何对象发生旋转运动后,只需要对基底坐标进行同样的旋转即可。因此对于刚体间的碰撞检测,OBB是一种比较好的选择,对于方向圆柱包围盒更加适合于几何体为圆柱的物体。能够更加紧密,更加方便的应用,从而提高了碰撞检测的效率。参考文献:1 Sankar Jayaram etal. VADE: A Virtual Assembly Desi

17、gn EnvironmentJ. IEEE Computer Graphics and Applications, 1999(6), on page 44-50.2 Ritchie J M, Dewar R G, Simmons J E L。 The generation and practical use of plans for manual assembly using immersive virtual reality J. Proc Inst Mech Engrs Part B (S0954-4054), 1999, 23(6): 461-474.3 Deviprasad T ,Ke

18、savadas T. Virtual Prototyping of Assembly Components Using Process Modeling J. Journal of Manufacturing Systems (S0278-6125), 2003, 22(1): 16-27.4 Dewar, R.G., Carpenter, I.D, Ritchie, J.M. Simmons, J.E.L, Assembly planning in a virtual environment, PICMET 97: Portland International Conference on M

19、anagement and Technology, Portland, 1997. 5 洪嘉振,杨辉,碰撞检测问题研究综述J,软件学报,1999,10(5) : 545-551.6 高玉琴,三维空间中碰撞检测算法的研究 D ,华中科技大学,硕士学位论文,2007.7 范昭炜,万华根,高曙明。基于并行的快速碰撞检测算法J。系统仿真学报,2000,12(5):548-552.8 李康顺,李元香,汤铭端,等。遗传程序设计在统计建模中的应用J。系统仿真学报,2005(7).Editors note: Judson Jones is a meteorologist, journalist and pho

20、tographer. He has freelanced with CNN for four years, covering severe weather from tornadoes to typhoons. Follow him on Twitter: jnjonesjr (CNN) - I will always wonder what it was like to huddle around a shortwave radio and through the crackling static from space hear the faint beeps of the worlds f

21、irst satellite - Sputnik. I also missed watching Neil Armstrong step foot on the moon and the first space shuttle take off for the stars. Those events were way before my time.As a kid, I was fascinated with what goes on in the sky, and when NASA pulled the plug on the shuttle program I was heartbrok

22、en. Yet the privatized space race has renewed my childhood dreams to reach for the stars.As a meteorologist, Ive still seen many important weather and space events, but right now, if you were sitting next to me, youd hear my foot tapping rapidly under my desk. Im anxious for the next one: a space ca

23、psule hanging from a crane in the New Mexico desert.Its like the set for a George Lucas movie floating to the edge of space.You and I will have the chance to watch a man take a leap into an unimaginable free fall from the edge of space - live.The (lack of) air up there Watch man jump from 96,000 fee

24、t Tuesday, I sat at work glued to the live stream of the Red Bull Stratos Mission. I watched the balloons positioned at different altitudes in the sky to test the winds, knowing that if they would just line up in a vertical straight line we would be go for launch.I feel this mission was created for

25、me because I am also a journalist and a photographer, but above all I live for taking a leap of faith - the feeling of pushing the envelope into uncharted territory.The guy who is going to do this, Felix Baumgartner, must have that same feeling, at a level I will never reach. However, it did not sto

26、p me from feeling his pain when a gust of swirling wind kicked up and twisted the partially filled balloon that would take him to the upper end of our atmosphere. As soon as the 40-acre balloon, with skin no thicker than a dry cleaning bag, scraped the ground I knew it was over.How claustrophobia al

27、most grounded supersonic skydiverWith each twist, you could see the wrinkles of disappointment on the face of the current record holder and capcom (capsule communications), Col. Joe Kittinger. He hung his head low in mission control as he told Baumgartner the disappointing news: Mission aborted.The

28、supersonic descent could happen as early as Sunday.The weather plays an important role in this mission. Starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. The balloon, with capsule attached, will move through th

29、e lower level of the atmosphere (the troposphere) where our day-to-day weather lives. It will climb higher than the tip of Mount Everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.17 kilometers) and into the stratosphere. As he c

30、rosses the boundary layer (called the tropopause), he can expect a lot of turbulence.The balloon will slowly drift to the edge of space at 120,000 feet (22.7 miles/36.53 kilometers). Here, Fearless Felix will unclip. He will roll back the door.Then, I would assume, he will slowly step out onto somet

31、hing resembling an Olympic diving platform.Below, the Earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. Still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. It will be like he is diving into the

32、 shallow end.Skydiver preps for the big jumpWhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. Like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to Earth. But this will not be enough to stop him

33、 completely.If he goes too fast or spins out of control, he has a stabilization parachute that can be deployed to slow him down. His team hopes its not needed. Instead, he plans to deploy his 270-square-foot (25-square-meter) main chute at an altitude of around 5,000 feet (1,524 meters).In order to

34、deploy this chute successfully, he will have to slow to 172 mph (277 kph). He will have a reserve parachute that will open automatically if he loses consciousness at mach speeds.Even if everything goes as planned, it wont. Baumgartner still will free fall at a speed that would cause you and me to pa

35、ss out, and no parachute is guaranteed to work higher than 25,000 feet (7,620 meters).It might not be the moon, but Kittinger free fell from 102,800 feet in 1960 - at the dawn of an infamous space race that captured the hearts of many. Baumgartner will attempt to break that record, a feat that boggles the mind. This is one of those monumental moments I will always remember, because there is no way Id miss this.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号