Пример #1
0
 /// <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));
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Used for filling and refilling spheres.
 /// The triangle ID is added to the list within each smaller sphere.
 /// </summary>
 private static void FillWithTriangles(List<StructureSphere> spheres, DiabolicalModel aModel, MainForm form)
 {
     int status = 0;
     Triangle tri = new Triangle();
     bool result = false;
     BoundingSphere bound;
     int count = aModel.CountTriangles();
     for (int t = 0; t < count; t++)
     {
         status++;
         if (status > 33)
         {
             status = 0;
             form.ShowStatus("Fill with triangle: " + t.ToString());
         }
         aModel.GetTriangle(ref t, ref tri);
         for (int s = 0; s < spheres.Count; s++)
         {
             bound = spheres[s].Sphere;
             tri.Intersects(ref bound, out result);
             if (result)
             {
                 spheres[s].IDs.Add(t);
             }
         }
     }
 }