Somatotopy is "the correspondence of receptors in regions or parts of the body via respective nerve fibers to specific functional areas of the cerebral cortex." In other words, it's the mapping from a 2D sheet of skin to a 2D sheet of brain. Furthermore, it maintains topographic relationships: points near each other on the body surface are represented near each other in the brain. This is the basic idea behind the homunculus representation of the sensory and motor cortices. Note that brain regions learn to devote more real estate to those areas that need high resolution representations.
In preparation for an experiment on a simulated human involving my brain-inspired AI architecture, I needed a way to transform a relatively complex body surface into a simple 2D array representation. The hard part is that the transformation must maintain topographic relationships. Fortunately, there already exists a tool to do this: self-organizing maps.
The images below show my topographic map learning to cover several "body" surfaces, including a simple torso, a hand, a human head, a human body, a wooden doll, and a sword. The maps start out as flat 2D sheets and learns to wrap around the body. Where does the training data come from? I simulate random data points from the body surface... sort of like having someone constantly poke it in different places. The topographic map responds to these data points by moving part of itself closer to them. One cool thing about my method is that it automatically learns to represent the most-touched regions with higher fidelity; it's like how our brains use more real estate to represent our hands and faces. (In these examples, I'm sampling the vertices of 3D models, which results in higher map density in places with high vertex density. For example, the human head model has a lot of vertices in the mouth cavity, so it becomes well-represented in the topographic map.)
One way to think of this is a flat sheet of brain (e.g. somatosensory cortex) stretching itself in sensory space to represent the entire body surface.