2

I have a surface mesh of triangles. Assume, the surface mesh is closed.

Surface mesh

I intend to do a spatial query to figure out whether a space is within my surface mesh or not. Space unit can be represented by a bounding box, a voxel or any other spatial tool.

  • What data structures are available to do the above query?
  • What algorithms are available to implement the query from scratch?
  • Are any ready-to-use libraries available?

Thanks =)

Megidd
  • 7,089
  • 6
  • 65
  • 142

3 Answers3

2

I don't think an R-tree will help directly to find what's inside a closed mesh.

If the data has separate "bubbles", chunks of space enclosed by meshes, those could be represented by bounding boxes and put in an R-tree index. That would help find which bubbles may intersect the query object, so that further checking can be done (really it would eliminate the bubbles that could not intersect, so they don't need to be checked).

If you can somehow break up the space inside your mesh into smaller chunks, those could be indexed. OK if they overlap or extend outside the mesh.

Antonin
  • 149
  • 1
1

If the mesh is totally closed, and for a single point, you can use Ray Tracing to shoot a ray from your point to any direction and see how many times it hits the mesh. If it hits an odd number of times, it's inside, if it hits an even number it's outside. For other shapes, however, you might need collision detection.

Existing libraries will depend on which platform/programming language you're doing this for, but if you have freedom to choose, maybe start with Unity?

As Antonin mentioned in their answer, an R-Tree index will help you with that but won't directly check if a point or other shape is inside your mesh. If you can break up the space inside your mesh into boxes, R-Trees will help you do "quick checks" for the positive case where your point or shape is inside the mesh.

Rafael Almeida
  • 10,352
  • 6
  • 45
  • 60
0

VDB: hollow vs filled

In the following video, it is demonstrated how we can create two type of VDB by Houdini:

  • Distance: hollow volume: creates a shell of voxels on geometry outside
  • Fog: solid volume: fills the geometry with voxels

https://youtu.be/jqNRu8BYYXo?t=259

Implication

This implies that it is possible to tag hollow and filled voxels by VDB. But I don't know how to do it programmatically with voxel code.

Megidd
  • 7,089
  • 6
  • 65
  • 142