Example #1
0
        private void CreateTwistMaps()
        {
            PermByMatr perm = new PermByMatr(Axes.Length, Faces.Length);

            foreach (PBaseAxis Ax in BaseAxes)
            {
                foreach (PBaseTwist tw in Ax.Twists)
                {
                    double[,] matr = PGeom.ApplyTwist(tw.Dir, PGeom.MatrixIdentity(Dim));
                    int[][] R  = ConvertStickersFromLayers(Ax, matr, perm);
                    int[][] R1 = new int[Ax.NLayers][];
                    for (int i = 0; i < Ax.NLayers; i++)
                    {
                        if (R[i] != null)
                        {
                            R1[i] = new int[R[i].Length];
                            for (int j = 0; j < R[i].Length; j++)
                            {
                                int h = Array.BinarySearch <int>(Ax.Layers[i], R[i][j]);
                                if (h < 0)
                                {
                                    throw new Exception("Can't find sticker image in twist");
                                }
                                R[i][j] = h; R1[i][h] = j;
                            }
                        }
                    }
                    tw.Map = R; tw.InvMap = R1;
                }
            }
        }
Example #2
0
        internal PFace(PBaseFace bas)
        {
            Base = bas;
            Pole = bas.Pole;
            int dim = Pole.Length;

            Matrix  = PGeom.MatrixIdentity(dim);
            RefAxis = 0;
        }
Example #3
0
        internal PAxis(PBaseAxis bas)
        {
            Base = bas;
            Dir  = bas.Dir;
            int dim = Dir.Length;

            Matrix = PGeom.MatrixIdentity(dim);
            int ntw = bas.Twists.Length;

            Twists = new double[ntw][];
            for (int i = 0; i < ntw; i++)
            {
                Twists[i] = bas.Twists[i].Dir;
            }
        }
Example #4
0
 internal PBaseFace(double[] pole)
 {
     Pole      = pole;
     SMatrices = new ArrayList();
     SMatrices.Add(PGeom.MatrixIdentity(pole.Length));
 }