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

查看:112
本文介绍了如何知道一个点是否在复杂的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形状? / strong> (我找到了几个库,但是对于我想做的任务来说似乎真的很复杂: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天全站免登陆