/// <summary> /// Optimise the size of the spheres. /// </summary> private static void OptimiseFittedSphere(List<StructureSphere> spheres, DiabolicalModel aModel, MainForm form) { form.ShowStatus("Optimise Sphere Sizes..."); Triangle tri = new Triangle(); List<Vector3> points = new List<Vector3>(); for (int s = 0; s < spheres.Count; s++) { points.Clear(); for (int t = 0; t < spheres[s].IDs.Count; t++) { aModel.GetTriangle(ref t, ref tri); points.AddRange(tri.PointsInsideSphere(spheres[s].Sphere)); } if (points.Count > 0) { spheres[s].RePosition(SmallestToFit(points)); } } }