Suppose you need a tri-dimensional file that contains a platonic polyhedron, say, an octahedron or an icosahedron, stored as a mesh. This file should, however, meet certain criteria: be in an useful format that can be imported into modelling applications, such as Blender, and be easily manipulable using scripts in languages suited for numerical computations, such as Octave or R and perhaps even be manipulated directly from the shell, using, e.g., gawk.

To meet these demands, below is a tool that creates any of the five platonic polyhedra in Wavefront Object format, with the ***.obj** extension (in ASCII). The user can specify the desired edge length, the area of the face, the total area, the total volume, the radius of the circumscribed sphere, or the radius of the inscribed sphere.

The tool also allows **recursive subdivision** of the faces of the polyhedra that are made of triangular faces (tetrahedron, octahedron and icosahedron). The subdivision implemented allows geodesic spheres of Class I (Kenner, 1976) to be produced easily. It is also possible to apply **affine transformations** to the coordinates of the vertices, so that the resulting mesh can be scaled, translated, rotated and sheared in any direction. Finally, it is possible to **randomly perturb** the vertex positions, so that the mesh becomes irregular, yet preserving the original topology.

In the case of recursive subdivision, it is important to note that not all edges have the same length, and not all faces have the same area. See the figure below for an illustration:

The formulas to calculate the number of vertices, edges and faces are:

- Number of vertices: ;
- Number of edges: ;
- Number of faces: ;

where , and are, respectively, the number of faces, vertices and edges of the polyhedron with triangular faces used for the initial subdivision:

- Tetrahedron: , and ;
- Octahedron: , and ;
- Icosahedron: , and .

The figure above and the formulas have been discussed by Winkler et al., 2012.

## Main file

The links to the script are below. Either of these will work; choose according to your needs:

**platonic**– This is the Octave script. Simply download it, change the first line to point to your correct Octave location, make it executable, and run it directly from the shell. Call it without arguments to obtain usage information.**platonic.m**– This is the same as above, but can be executed from within Octave or MATLAB. Type ‘help platonic’ to obtain usage information.

## Requirements

**subdivtri.m**– Add this to your Octave or MATLAB path.

## Examples

To create an icosahedron with radius 100, recursively subdivided 7 times, if from the shell, use:

platonic ico7.obj ico sph 7 100

or, if from inside Octave/MATLAB, use:

platonic('ico7.obj','ico','sph',7,100);

The outputs from `platonic`

are always in Wavefront (.obj) format. To use this icosahedron, e.g., with areal interpolation, it needs to be converted to FreeSurfer ascii format:

obj2srf ico7.obj > ico7.srf

The obj2srf command is available in the package for areal analysis, here.

## References

- Kenner H.
*Geodesic math and how to use it.*University of California Press, Los Angeles, USA, 1976. - Winkler AM, Sabuncu MR, Yeo BT, Fischl B, Greve DN, Kochunov P, Nichols TE, Blangero J, Glahn DC. Measuring and comparing brain cortical surface area and other areal quantities.
*Neuroimage*. 2012 Jul 16;61(4):1428-43

Could you please add an example on how to produce and ico7.srf with platonic, which is used with area interpretation?

Sure, I just updated with an example. Hope it helps.

Pingback: Displaying vertexwise and facewise brain maps | Brainder.

Pingback: Fast surface smoothing on a common grid | Brainder.

Pingback: Downsampling (decimating) a brain surface | Brainder.