Java 3D: Get intersection of two Shape3D's?

会有一股神秘感。 提交于 2020-01-07 02:18:15

问题


Is it possible to get the intersection co-ords of two shapes3d's?

(One is a Line and the other is a QuadArray)

Just wondering if there is a simple way before I try a hack and slash method?

-I'm pretty new to Java 3D so I may have missed a function which does exactly what I need.


回答1:


The Easy way is to use Bounds and intersect method :

Bounds quadArrayBounds = quadArrayShape.getBounds();
if (quadArrayBounds.intersect(new Point3d(startLine.x, startLine.y, startLine.z), 
new Vector3d(endLine.x, endLine.y, endLine.z))){
               // Action to do if Intesect is true
            }


来源:https://stackoverflow.com/questions/8463833/java-3d-get-intersection-of-two-shape3ds

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!