Number of diagonals

The seven solids below are uniform, all vertices of each being identical. They have octahedral symmetry and their side length is unit. The squared distance to each vertex is calculated below.
For instance, select a vertex v of a cube. It has one vertex (v itself) at zero distance to v and three vertices at unit distance (edges) to v. There are three diagonals (next to v) of length √2 and one diagonal of length √3.


Sample code