This program demonstrates the quaternion belt-trick, also known as the Dirac belt-trick and the waiter trick. It generates an AVI movie file (also included) which shows a stereo movie of the belt-trick in action.
(1) If you want to save time and see the end-result, just watch the included AVI movie. It opens in Windows Explorer with Windows Media Player. The program is really included just to show you how it was done.
(2) The movie is stereoscopic. If you sit back at least a meter from the screen and cross your eyes slightly to fuse the two images in your "mind's eye", you should get a nice stereoscopic effect.
(3) The program takes a few minutes to generate the AVI movie - about 10 minutes on a 3GHz machine. It produces one figure for each frame of video and takes a little software snapshot of each one. There are 96 frames in the movie, the msximum allowed. Any screensavers, pop-up windows, or moving about on the desktop while the program is running can mess up the resulting movie. This problem is due to the way MatLab does its movies and it seems to be unavoidable.
(4) The program utilizes a quaternion data class for the quaternion calculations. I wrote the data class and it is very compact but also full-featured. You can separately download it for free from the same place in Matlab Central where you got this program. Matlab data classes, while a somewhat obscure topic, are very powerful, easy, and interesting and are well worth learning about. With data classes you can create a working algebra with nearly any properties you can imagine. My motivation for writing the quaternion data class was to fully understand something mathematicians call the "Cayley-Dickson Construction" which defines quaternions as recursive complex numbers.
(5) The AVI file included is a compressed version of the original AVI output, which was quite large, about 140Mb.
Credits: The general idea for this program came from the book, Knots and Physics, by Louis H Kauffman, World Scientific. Dr Kauffman included a clever BASIC program in that book that inspired this program.
Bill Davidson (2024). Quaternion belt-trick (https://www.mathworks.com/matlabcentral/fileexchange/22109-quaternion-belt-trick), 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!