public static void FindPositionForPartAndAddToPlate(Mesh meshToAdd, Matrix4X4 meshTransform, List <PlatingMeshData> perMeshInfo, List <Mesh> meshesToAvoid, List <Matrix4X4> meshTransforms)
        {
            if (meshToAdd == null || meshToAdd.Vertices.Count < 3)
            {
                return;
            }

            meshesToAvoid.Add(meshToAdd);

            PlatingMeshData newMeshInfo = new PlatingMeshData();

            perMeshInfo.Add(newMeshInfo);
            meshTransforms.Add(meshTransform);

            int index = meshesToAvoid.Count - 1;

            MoveMeshToOpenPosition(index, perMeshInfo, meshesToAvoid, meshTransforms);

            PlaceMeshOnBed(meshesToAvoid, meshTransforms, index, false);
        }
        public static void FindPositionForPartAndAddToPlate(Mesh meshToAdd, ScaleRotateTranslate meshTransform, List<PlatingMeshData> perMeshInfo, List<Mesh> meshesToAvoid, List<ScaleRotateTranslate> meshTransforms)
        {
            if (meshToAdd == null || meshToAdd.Vertices.Count < 3)
            {
                return;
            }

            meshesToAvoid.Add(meshToAdd);

            PlatingMeshData newMeshInfo = new PlatingMeshData();
            perMeshInfo.Add(newMeshInfo);
            meshTransforms.Add(meshTransform);

            int index = meshesToAvoid.Count-1;
            MoveMeshToOpenPosition(index, perMeshInfo, meshesToAvoid, meshTransforms);

            PlaceMeshOnBed(meshesToAvoid, meshTransforms, index, false);
        }
        void createDiscreteMeshesBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            BackgroundWorker backgroundWorker = (BackgroundWorker)sender;

            Mesh[] meshes = CreateDiscreteMeshes.SplitIntoMeshes(SelectedMesh, meshViewerWidget.DisplayVolume, backgroundWorker, 0, 50);

            asynchMeshesList.Clear();
            asynchPlatingDataList.Clear();
            asynchMeshTransforms.Clear();
            for (int i = 0; i < meshes.Length; i++)
            {
                PlatingMeshData newInfo = new PlatingMeshData();
                asynchPlatingDataList.Add(newInfo);
                asynchMeshesList.Add(meshes[i]);
                asynchMeshTransforms.Add(Matrix4X4.Identity);

                PlatingHelper.CreateITraceableForMesh(asynchPlatingDataList, asynchMeshesList, i);
                if (meshes.Length > 1)
                {
                    backgroundWorker.ReportProgress(50 + i * 50 / (meshes.Length - 1));
                }
            }
        }
 private void PushMeshDataToAsynchLists(bool copyTraceInfo)
 {
     asynchMeshesList.Clear();
     asynchMeshTransforms.Clear();
     for (int i = 0; i < Meshes.Count; i++)
     {
         Mesh mesh = Meshes[i];
         asynchMeshesList.Add(new Mesh(mesh));
         asynchMeshTransforms.Add(MeshTransforms[i]);
     }
     asynchPlatingDataList.Clear();
     for (int i = 0; i < MeshExtraData.Count; i++)
     {
         PlatingMeshData meshData = new PlatingMeshData();
         meshData.currentScale = MeshExtraData[i].currentScale;
         if (copyTraceInfo)
         {
             meshData.traceableData = MeshExtraData[i].traceableData;
         }
         asynchPlatingDataList.Add(meshData);
     }
 }