MATLAB Answers

Polygon envelope of a 3D array

6 views (last 30 days)
Rob McDonald
Rob McDonald on 21 Feb 2015
Commented: Rob McDonald on 22 Feb 2015
I've written the attached function to find the polygon envelope of structured data in a 3D array. It works, but is very slow for large data sets. Does anyone know of a way to make it substantially faster?
Also, it is unfortunately limited to 3D array input (the Vert/Faces) approach enforces this limit. Does anyone see a way to generalize this to ND data?
If this were fast and generalized, I think it would make a nice addition to the File Exchange...

Answers (1)

Image Analyst
Image Analyst on 21 Feb 2015
Any reason why you didn't just use the built in convhulln()?
  4 Comments
Rob McDonald
Rob McDonald on 22 Feb 2015
Here is an updated version that avoids duplicate checks on interior faces. As expected, this achieves about a 2x speedup on a large problem.
Passing a list of polys doesn't automatically self-union the list, so any approach using lists would have to make sure they overlap. A sequence of i-strips then j-strips then k-strips may work.
However, figuring out when/how to start/stop each strip if NaN is encountered in the data is not obvious.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!