The boxfit.m function is developed for growing an active box shape which is initialized at the given seed point
location. The active box shape grows in different orientation and it tries to find the best fit into the edges of the object in the provided image.
Please open DEMO.m and run this code (with F5) in order to see an example which calls boxfit.m function.
The main advantage of the algorithm is that the best fit can be obtained even when the given object doesn't have all edges visible.
* Sample image is added.