Exemple #1
0
        public Figure(Dot size, string color)
        {
            Size = size;
            Color = color;
            Location = new Dot();
            CorrectOrientation = new Dot(0,0,0);

            InsideColor = new List<char>();
            foreach (char i in Color)
                if (i != '.')
                    InsideColor.Add(i);
        }
Exemple #2
0
 public void PackFront(List<Figure> figures, Figure paral)
 {
     List<Figure> frontFigure = new List<Figure>();
     Dot nextDot = new Dot(0, 0, 0);
     foreach (Figure f in figures)
     {
         if (f.InsideColor.Contains(paral.Color[0]))
         {
             if (f.Location.Compare(0, 0, 0))
             {
                 if ((paral.Size.X == f.CorrectOrientation.X) && (paral.Size.Y == f.CorrectOrientation.Y))
                     nextDot = new Dot(0, 0, f.CorrectOrientation.Z);
                 if ((paral.Size.X == f.CorrectOrientation.X) && (paral.Size.Z == f.CorrectOrientation.Z))
                     nextDot = new Dot(0, f.CorrectOrientation.Y, 0);
                 if ((paral.Size.Y == f.CorrectOrientation.Y) && (paral.Size.Z == f.CorrectOrientation.Z))
                 {
                     nextDot = new Dot(f.CorrectOrientation.X, 0, 0);
                     PackSide(figures, nextDot);
                     return;
                 }
             }
             else
                 if(f.Location.Compare(-1,-1,-1))
                     frontFigure.Add(f);
         }
     }
     foreach (Figure f in frontFigure)
     {
         if (nextDot.Z != 0)
         {
             f.Location.Set(nextDot.X, nextDot.Y, nextDot.Z);
             nextDot.Z += f.CorrectOrientation.Z;
         }
         if (nextDot.Y != 0)
         {
             f.Location.Set(nextDot.X, nextDot.Y, nextDot.Z);
             nextDot.Y += f.CorrectOrientation.Y;
         }
     }
 }
Exemple #3
0
        //Запихнуть сюда все координаты.
        private void PackSide(List<Figure> figures, Dot nextDot)
        {
            foreach (Figure f in figures)
            {
                if (f.Location.Compare(-1,-1,-1))
                {
                    f.Location.Set(nextDot.X, nextDot.Y, nextDot.Z);
                    nextDot.X += f.CorrectOrientation.X;
                }

            }
        }
Exemple #4
0
 public void FindOrientation(Orientator dict)
 {
     CorrectOrientation = new Dot(Size.DotDict[dict.Orientation[Color].Item1[0]],
                                  Size.DotDict[dict.Orientation[Color].Item1[1]],
                                  Size.DotDict[dict.Orientation[Color].Item1[2]]);
     Sides = dict.Orientation[Color].Item2;
 }