In my day job in scientific visualization, I am sometimes called upon to display models of neurons or molecules. Both types of models are "graph-like", in the computer science data structure sense, in that they consist of a collecion of Nodes, connected by Edges.
General Graph data structure. This graph consists of six edges and seven nodes. |
In the case of molecules, the Nodes are Atoms, and the Edges are Bonds. Molecules and atoms make up all of the air and earth and animals and tacos and all the other stuff of the world.
This serotonin molecule contains 24 atoms and 26 bonds. This representation uses spheres and cylinders to represent atoms and bonds. |
This neuron has many branch points, tips and bends. Neurons are the cells that animals use to think and to control movement. |
Imposter models look better and run faster. What's not to like? The only downside is that it requires a lot of tricky work on the part of the programmer. Me.
You probably learned the quadratic formula in high school:
$$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$
In any case, the quadratic formula can be used to solve for \(x\) in polynomial equations of the form:
$$ax^2+bx+c=0$$
So the trick for imposter rendering is to derive a quadratic polynomial for each analytic shape you want to display. I have already done this and have it working for the following shapes:
- Sphere (easiest)
- Cylinder
- Cone
I plan to eventually do the same treatment for
- Ellipsoid
- Ellipsoid cylinder
- Ellipsoid cone
- Single sheet hyperboloid
- Dual sheet hyperboloid