/// <summary> /// Validates the edge lengths of a Icosahedron using its provided vertices. /// <remarks>Simply validates the edges of 'a' as too much manual work to validate them all.</remarks> /// <see cref="http://csharphelper.com/blog/2015/12/platonic-solids-part-6-the-icosahedron/" for diagram./> /// </summary> /// <param name="edgeLength">The length of the edge between neighboring vertices.</param> /// <param name="vertices">The vertices.</param> private static void ValidateEdgeLengths(float edgeLength, Vector3[] vertices) { Vector3 a = vertices[0]; float sqrdEdgeLength = edgeLength * edgeLength; Vector3[] aEdges = new Vector3[] { vertices[1] - a, // a-b vertices[2] - a, // a-c vertices[3] - a, // a-d vertices[4] - a, // a-e vertices[5] - a // a-f }; aEdges.ForAll<Vector3>(edge => { bool isEqual = Mathfx.Approx(Vector3.SqrMagnitude(edge), sqrdEdgeLength, 1F); if (!isEqual) { D.Error("{0} should equal {1}.", Vector3.SqrMagnitude(edge), sqrdEdgeLength); } }); }