Code covered by the BSD License  

Highlights from
Minimal Bounding Box

5.0

5.0 | 2 ratings Rate this file 27 Downloads (last 30 days) File Size: 5.85 KB File ID: #18264
image thumbnail

Minimal Bounding Box

by Johannes Korsawe

 

09 Jan 2008 (Updated 09 Jan 2008)

Minimal bounding box around points in the (x,y,z) space

| Watch this File

File Information
Description

With this function one can easily compute the minimal box (with right angles) around a set of points in 3d.

The extremal property of the box is determined either in terms of volume, surface or sum of edgelengths.

The calculation is based on heuristics only, but a huge number of tests did not show any counterexamples yet.

The algorithm behind the function is subdivided into three levels of accuracy with differing runtimes.

x = rand(10000,1);
y = rand(10000,1);
z = rand(10000,1);

tic;[rotmat,cornerpoints,volume,surface] = minboundbox(x,y,z,'v',3);toc
Elapsed time is 10.772170 seconds.

volume =
    0.9993
surface =
    5.9974

My thanks to John d'Errico and Roger Stafford for numerous discussions about proofs and algorithms in this context.

John also wrote minboundrect from the FEX, which heavily influenced this submission.

Also in this archive i included a small plot function (plotminbox) to show the resulting box via connecting the cornerpoints.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
01 May 2011 Mark

This file saved me a ton of work, and has worked great for all of my tests, thanks!

21 Jul 2011 Steven

Nice work. Thank you.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
bounding Johannes Korsawe 22 Oct 2008 09:42:17
box Johannes Korsawe 22 Oct 2008 09:42:17
cuboid Johannes Korsawe 22 Oct 2008 09:42:17
minimum Johannes Korsawe 22 Oct 2008 09:42:17
surface Johannes Korsawe 22 Oct 2008 09:42:17

Contact us at files@mathworks.com