给定一边界框和一个线(两点),确定是否线相交的框 [英] Given a bounding box and a line (two points), determine if the line intersects the box
问题描述
给定一个边框,像 bounds.min定义。(X / Y / Z)
, bounds.max。(X / Y / Z)
,并在三维空间中的两个点(表示为的Vector3
对象),我怎么能判断出两个点相交之线做成?边框
Given a bounding box, with definitions like bounds.min.(x/y/z)
, bounds.max.(x/y/z)
, and two points in 3D space (expressed as Vector3
objects), how can I determine if the line made by the two points intersects the bounding box?
推荐答案
让我谷歌为你:的Line盒相交(的http:// www.3dkingdoms.com/weekly/weekly.php?a=3 )
另一个链接,用了很多的相交测试引用(和代码) : http://www.realtimerendering.com/intersections.html
Another link, with references (and code) for a lot of intersection tests: http://www.realtimerendering.com/intersections.html
如果您想了解更多关于相交测试,这个人是圣经:实时碰撞检测(亚马逊)
If you want to learn more about intersection tests, this one is the bible: Real-Time Collision Detection (Amazon)
编辑:在这个本文算法(一个高效,强大的雷盒交法,艾米·威廉姆斯和史蒂夫Barrus和R.基思·莫雷和彼得·雪莉;显卡,GPU和游戏的工具,卷杂志。 10(1),49-54,2005年)看起来特别简洁,并配备了(C ++)的源代码了。
the algorithm in this paper ("An Efficient and Robust Ray-Box Intersection Algorithm", Amy Williams and Steve Barrus and R. Keith Morley and Peter Shirley; journal of graphics, gpu, and game tools, Vol. 10(1), 49-54, 2005) looks especially concise and comes with (C++) source code, too.
这篇关于给定一边界框和一个线(两点),确定是否线相交的框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!