Ejemplo n.º 1
0
        void SetDefs(SkewbImageConfiguration config)
        {
            var defs = "";

            foreach (string face in Center.PieceNames)
            {
                var CornerIndices = Corner.GetStickerOrder(char.Parse(face));
                foreach (var cornerIndex in CornerIndices)
                {
                    var Faces = Corner.PieceNames[cornerIndex];
                    for (int i = 0; i < Faces.Length; i++)
                    {
                        if (char.Parse(face) == Faces[i])
                        {
                            defs += GetColorFromFace(Corners[cornerIndex].GetFace(i));
                        }
                    }
                }
                for (int i = 0; i < Center.PieceNames.Length; i++)
                {
                    if (face == Center.PieceNames[i])
                    {
                        defs += GetColorFromFace(char.Parse(Centers[i].PieceName));
                    }
                }
            }
            config.StickerDefs = defs;
        }
Ejemplo n.º 2
0
        public SkewbImageProp(SkewbImageConfiguration configs)
            : base(configs)
        {
            DFace = configs.Dface;

            ShortFaceDist = (ImageLength / 8) / Math.Cos(Math.PI * 30 / 180);
            LongFaceDist  = ShortFaceDist * 2;

            var yAboveCenter = (ImageLength / 8) * Math.Tan(Math.PI * 30 / 180) * 6;
            var yBelowCenter = LongFaceDist * (DFace ? 2 : 1);

            ImageSize = new Tuple <double, double>(ImageLength, yAboveCenter + yBelowCenter);

            Center = new CoordPair(ImageLength / 2, yAboveCenter);

            AddColorScheme(configs.ColorScheme);
        }
Ejemplo n.º 3
0
        public VirtualSkewb(SkewbImageConfiguration configs)
        {
            CleanSkewb();
            DefineMoves();

            if (configs.Moves != null)
            {
                PreformAlg(configs.Moves);
            }
            else if (configs.Case != null)
            {
                PreformAlg(configs.Case, reverse: true);
            }

            if (configs.StickerDefs == null)
            {
                SetDefs(configs);
            }
        }
Ejemplo n.º 4
0
        private void CreateFacees(SkewbImageConfiguration configs)
        {
            var stickerColors = ParseDefs(configs.StickerDefs);

            if (stickerColors.Length == 6 || (Properties.DFace && stickerColors.Length == 5))
            {
                var tempFaces = new List <Face>();
                for (int i = 0; i < 3; i++)
                {
                    var angle = Math.PI * 120 / 180 * i;
                    tempFaces.Add(new Face(stickerColors[i], angle, Properties.Center, Properties));
                    if (i != 0 || Properties.DFace)
                    {
                        tempFaces.Add(new Face(stickerColors[i + 3], (i == 0 ? 0 : Math.PI * 240 / 180)
                                               , CoordPair.CartesianFromPolar(Properties.LongFaceDist, angle, Properties.Center), Properties));
                    }
                }
                Faces = tempFaces.ToArray();
            }
        }
Ejemplo n.º 5
0
 public SkewbImage(SkewbImageConfiguration configs)
 {
     Properties = new SkewbImageProp(configs);
     CreateFacees(configs);
 }