The algorithm just finds the intersection points between the facets and a vertical line that passes through the original point. Depending on the relative position of the intsersection points and the facet normals it decides whether the point is outside or inside the volume.
a: structure with a.vertices and a.facets
p: [x y z] coordinates of the point to be studied
inout: 1 or 0 (in or out)
jon ander (2023). isinmesh (https://www.mathworks.com/matlabcentral/fileexchange/36326-isinmesh), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!