We live in a world where computers hold a constantly growing role and where research is done to try and make computers think by themselves, instead of letting them only execute computations that would be long to do by hand. The computer, originally a counting machine or "number cruncher", as the expression says, is now used to control aeroplanes, write reports, predict meteorological conditions and even train soldiers to kill efficiently without even having to risk their lives.
Realistic simulators are used by aeroplane pilots to learn how to fly and by physicists to analyze very complex phenomena using known physics laws. However, the most powerful computer network on earth would take months to simulate the first few milliseconds of a nuclear explosion. That is why computer manufacturers are constantly urged to create new and more powerful computers. The progress we are witnessing at the moment is only the beginning of the computer revolution.
We have always been interested in computers and like many kids of our age, we have played computer games offering a new identity in a three-dimensional universe on the two-dimensional computer screen. Evidently, we asked ourselves how the programmers realized this illusion on a two-dimensional monitor. Having already created an application that creates word search grids from a word list and seeing that we are able to work as a team, we decided to attack a project of three-dimensional molecule representation.
Our project was to conceive an application that would represent chemical molecules in 3D and that would be as powerful as what is already on the market (major hypothesis). We have already seen a similar application during our biology course (" pcmol ") and we considered it to be impressive. Also, our engine will be created to be re-useable. We will create our own class system (c++ technical term) to define molecules more rapidly, to make the engine faster and to give us time to use the engine to represent something other than a chemical molecule (minor hypothesis).
In the first part of this document, we will present the essence of our project complemented by a few technical details. The second part will explain in detail the creation of a 3D engine, a few problems we encountered and the solutions we found. The third part will be composed of many mathematical demonstrations for the formulas used throughout the project; it could almost be considered as a mathematical add-on to the document. Finally, the fourth part will present the conclusion to the project and a short discussion on our results.
Language, compiler et Internet resources
The ideas for the basic layout of the application come from the webpage of a computer addict who frequented our high school. This webpage rapidly presents a few mathematical notions and a few tips to help create a 3D engine. You can consult Jérôme St-Louis's webpage, The 3D Coding Blackhole, at the following address: http://pages.infinit.net/jstlouis/3dbhole/.
We used a C/C++ 32 bit compiler for DOS named DJGPP which is distributed freely at this address: http://www.delorie.com/djgpp/. We respected the standards of C/C++ as to have an application that could be compiled on any platform.
Sadly, the application lost the ability to be easily portable (an application is said to be portable when it can be compiled on different operating systems with little or no changes) when we decided to use Allegro (http://www.talula.demon.co.uk/allegro/), a graphical library that comes with DJGPP. This library offered us a variety of displaying functions that would have been a waste of time to recode ourselves. A few graphic libraries (including Allegro) offer 3D functions like the ones we had to create. However, we did not want to use these functions since our goal was to create and understand them. If we wanted to run 3DMOL on another operating system (Linux, BeOS, Unix, etc.) we would have to change Allegro for another graphical library. We are conscious that we could have created the application using the Java language to eliminate all portability problems. However, our Java programming skills are not as developed as our C/C++ skills, therefore doubling or tripling the creation time of the application because of our inexperience with this language.
A few words on the mathematical aspect of the project
We found many websites that talk about 3D engines and the mathematical formulas they used, but none of them explained their formulas. These websites were created for computer programmers that do not have the mathematical knowledge, the time or the desire to understand the mathematical aspect of the project. They only want to create their own 3D engine without learning anything. We, on the other hand, for our school project, will prove our formulas. The formulas we used are very similar to what we can find anywhere on the Internet, which is reassuring.
When we will reference a formula that was proven in this document, we will display a blue number next to it. To facilitate the reading of this document, we have chosen to present the mathematical proofs in a separate section from the one explaining the creation of a 3D engine. This will allow you, the reader, to easily understand every concept by concentrating on one aspect at a time.
Therefore, our objective is to create a 3D chemical molecule representation software similar to what is already on the Internet to then show that it can be reused to create something other than molecules.