如何知道一个点是否在复杂的 3D 形状内(.ply 文件) [英] How to know if a point is inside a complex 3D shape (.ply file)

查看:20
本文介绍了如何知道一个点是否在复杂的 3D 形状内(.ply 文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个 Java 项目,女巫真的要杀了我.经过几天在不同论坛的研究,寻找我真正需要的东西,我来寻求您的帮助.

I'm working on a Java project witch is really killing me. After several days of researching on different forums, looking for what I really need, I come to ask your help.

我的数据:

  • 一个 .ply 文件(包含由许多三角形组成的 3D 形状)
  • 一个点(3D 坐标)

我想知道这个点是否包含在复杂的 3D 形状中.

I would like to know if this point is contained inside the complex 3D shape.

我把这个问题分成了两个小问题:

I have split this problem in 2 smaller problems :

  • 如何在内存中表示复杂的 3D 形状? (我找到了几个库,但对于我想做的任务来说似乎非常复杂:Java3D、JBullet、JME3...) 我不希望我的 Java 应用程序现在显示该对象.

我怎么知道这个点是否在 3D 形状内? (我想从点开始制作一个 3D 矢量并计算交叉点的数量形状,但我不知道该怎么做,我可以使用女巫库吗?)

也许有更简单的方法可以做到,这也是我来找你的原因.我现在真的被困住了,我想如果不编写海关库就可以做到这一点......

Maybe there are easier ways to do it, that's also why I come to you. I am really stuck now and I would like if this is possible without writing customs libraries...

(抱歉我的文笔,我不会英文^^)

(Sorry for my writing, I'm not English ^^)

谢谢你帮助我.

推荐答案

这是一种方法.不是最好的或最快的,但一旦你有一些工作,就会更容易改进.

Here is one approach. Not the best or the fastest, but once you have something working, it will be easier to improve upon.

如何在内存中表示复杂的 3D 形状?

How can I represent the complex 3D shape in memory?

实现一个快速而肮脏的 PLY 文件格式解析器.这是PLY 格式规范.加载数据并将其存储在内部:每个 X、Y 和 Z 的数组.这只是普通的 Java.

Implement a quick and dirty PLY file format parser. Here is the PLY format spec. Load the data up and store it internally: an array for each X, Y, and Z. This is all just plain Java.

我如何知道这个点是否在 3D 形状内?

How can I know if this point is inside the 3D shape or not?

根据您的点和其他任意点定义一条线.对于每个多边形,确定它与平面相交的位置(一些帮助),如果交点在多边形内部或外部(一些帮助).按照您的建议,然后计算交叉点的数量以确定该点是在您的 3d 形状内部还是外部.

Define a line based on your point and some other arbitrary point. For each polygon, determine where it intersects the plane (some help) and if the intersection point is inside or outside the polygon (some help). As you suggested, then count the number of intersections to determine if the point is inside or outside your 3d shape.

这篇关于如何知道一个点是否在复杂的 3D 形状内(.ply 文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆