How to find out if a point is inside a complex three-dimensional figure (.ply file)

I am working on a Java project that really kills me. After several days of research in various forums, looking for what I really need, I come to ask your help.

My details:

  • .Ply file (containing a three-dimensional shape consisting of a large number of triangles)
  • Point (3D coordinates)

I would like to know if this point is contained within a complex three-dimensional figure.

I divided this problem into two smaller tasks:

  • How can I imagine a complex three-dimensional shape in memory? (I found several libraries, but it seems very difficult for the task I want to do: Java3D, JBullet, JME3 ...) I do not want my Java application to display the object at the moment.

  • How do I know if this point is inside a 3D shape or not? (I thought the 3D vector starts from a point and counts the number of intersections with the form, but I don’t see how to do this, and can the witch library be used?)

There may be simpler ways to do this, and so I come to you. I am really stuck now, and I would like, if possible, without writing custom libraries ...

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

Thanks for helping me.

+4
source share
1 answer

Here is one approach. Not the best or fastest, but as soon as you have something, it will be easier for you to improve.

How can I imagine a complex three-dimensional shape in memory?

Implement fast and dirty parsing of the PLY file format. Here is the PLY format specification . Download the data and save it inside: an array for each X, Y, and Z. This is just plain Java.

How can I find out if this point is inside a 3D shape or not?

Define a string 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.

0
source

All Articles