Turning triangulation data into 3D spatial matrix
20 views (last 30 days)
Show older comments
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)
0 Comments
Accepted Answer
Cris LaPierre
on 4 Aug 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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!