John Ratcliff's Code Suppository

A place where I insert my code into the anus of the Internet.

 

Friday, November 28, 2008

How to use the OBB fitting code



I have received a number of emails from people who are confused about how to use my various code snippets. 

I have decided that, in the future, I am going to present my code snippets in the form of a single large graphics application.  At first you might think this defeats the purpose of the 'snippets' concept, but really I don't think it does.  The code will still be in snippet form, but will come packaged in a framework that demonstrates the usage pattern.

For example, some poeple have complained that my OBB fitting code doesn't work.  I know this is not true, because I use the OBB fitting routine in production code all of the time.  It's most likely they are just using the routine incorrectly.

But placing the code snippet in a graphics framework, I can actually draw a point cloud and the resulting OBB produced so that people can get a clear visual demonstration that it is, in fact, working.

Sometime in the next couple of weeks I will be uploading my code snippets in this single package format.

A lot of the math based code snippets are now folded into a single piece of source called 'FloatMath'.   The design of FloatMath is that, even though it is a single large source file, individual code snippets and routines can be extracted from it.  Or, you can just use the whole file if you prefer.  It is turning out to be an excellent reference for a wide variety of math and geometric computation routines.

The FloatMath library has been refactored so that it supports both 'float' and 'double' types of all of the routines.  

It is comprised of three source files.

FloatMath.h         : which contains the prototypes for all of the routines.
FloatMath.inl       : which contains the conditionally compiled implementation
FloatMath.cpp    : which includes FloatMath.inl twice to produce both the 'float' and the 'double' implemnetations of each method.

I have also uploaded a small zip file that shows how to call the OBB fitting routines.


---------Note: I just re-uploaded the code, and I also improved the OBB fitting algorithm.  It now uses the best fit plane technique to derive a rotation matrix to fit the point cloud and then only rotates the points on a single axis of rotation to converge to the best fit solution.  

4 Comments:

  • At 1:40 PM, Anonymous Niki said…

    Permission is hereby granted, MEMALLOC_FREE of charge ...

    LOL

     
  • At 2:24 PM, Blogger John said…

    The power for global find/replace. MEMALLOC_FREE is much better than ordinary free anyway...

     
  • At 11:09 AM, Blogger John said…

    Note: I just re-uploaded the code, and I also improved the OBB fitting algorithm. It now uses the best fit plane technique to derive a rotation matrix to fit the point cloud and then only rotates the points on a single axis of rotation to converge to the best fit solution.

     
  • At 6:09 AM, Blogger poo said…

    First of all, I want to thank you for your work. It has really helped me a lot.

    Did you make graphical framework for OBB? Actually, I need graphical framework for Best Fit Plane. Please help me in this regard.

    Thanks..

     

Post a Comment

<< Home