示例#1
0
 //Konstruktor für Input-Funktion vorgesehen
 public Voxelmodell(int anzahlSchichten, Voxel[,,] voxelmatrix, List <List <Voxel> > schichten, int infillDensity = 20, string infillType = "3DInfill")
 {
     m_AnzahlSchichten = anzahlSchichten;
     m_Boundingbox     = new Infill(infillDensity, infillType);
     m_Voxelmatrix     = voxelmatrix;
     m_Schichten       = schichten;
 }
        /*Funktion, die eine Boundingbox eines Infill-Musters
         * (derselben Größe(!)) mit dem Voxelmodell merged.
         * Bounding-Box : true = Voxel gesetzt im Infill */
        public void InsertInfill(int infillDensity = 20, string infillType = "3DInfill", int offset = 0)
        {
            Infill m_Boundingbox = new Infill(infillDensity, infillType, offset);

            ushort[] koords = new ushort[3];
            //Schleifen die über alle Voxel des Modells gehen
            Parallel.For(0, m_Schichten.Count(), j =>
            {
                Console.WriteLine("Prozessing infill for layer:" + j);
                for (int i = 0; i < m_Schichten[j].Count(); i++)
                {
                    //Voxel die Teil des Randes sind kommen nicht in Frage
                    if (m_Schichten[j][i].getModellrand() != true)
                    {
                        lock (m_Schichten)//Why, just why?
                        {
                            koords = m_Schichten[j][i].getKoords();
                            //Falls kein Infill an Stelle des Voxels, lösche diesen
                            //aus unserem Voxelmodell
                            if (0 == m_Boundingbox.IsInfill(koords[0], koords[1], koords[2]))
                            {
                                m_Voxelmatrix[koords[0], koords[1], koords[2]] = null;
                                this.m_Schichten[j].Remove(this.m_Schichten[j][i]);
                                i--;
                            }
                        }
                    }
                }
            });
        }