Turning triangulation data into 3D spatial matrix

22 visualizaciones (últimos 30 días)
lunalara
lunalara el 3 de Ag. de 2020
Comentada: Cris LaPierre el 4 de Ag. de 2020
Hello all,
I am trying to import an STL file (or some similar 3D model file format) and turn the information into a 3D matrix specifying 'presence' of the object.
For example, if considering the solid geometry as in the attached image, each plane (1-4 etc) would represent a 2D logical matrix, with '1' specifying the presence of the surface within that plane. These planes will eventually represent equally-spaced, planar locations in the out-of-plane direction.
I have successfully imported the geometry as a triangulation, and am able to see the surface in 3-D space when plotting with trisurf(), but am wondering if anyone has thoughts on how to convert/consider the triangulation data as a solid object to work with it in the aforementioned manner?
The actual geometries that will be considered are much more complex than the one mentioned here (with holes etc), but I thought the block would be a good place to start.
*Note: I know this is a weird problem, and any thoughts are greatly appreciated. :)
**Note: I tried to upload the .stl, but the format is unsupported. I would be happy to supply if requested.
Thanks in advance!
filename = [path '/TestGeom.stl'];
>> stlread(filename)
ans =
triangulation with properties:
Points: [10×3 double]
ConnectivityList: [16×3 double]
>> trisurf(ans)

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 4 de Ag. de 2020
I would see if the inpolygon function can be used here. It works for 2D data, but with some creativity, you may be able to get it to work. It is able to detect points between two polygons, a necessary feature for geometries that might have holes.
  3 comentarios
lunalara
lunalara el 4 de Ag. de 2020
Hi again Cris,
Thanks to your inpolygon advice, I was able to find/utilize this other function inpolyhedron, which works very well for finding points within a 3D space! One might suggest using this function with STL vertices and faces imported via the FEX function stlread (note: this is different from the MATLAB built-in 'stlread', so users should save/call it with a slightly changed title to avoid confusion).
The rest is just defining my X,Y,Z points, but that's a personal problem... ;)
Thank you again for your advice. I wouldn't have found it without you.
Cheers!
Cris LaPierre
Cris LaPierre el 4 de Ag. de 2020
You're welcome. Nice find.

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by