Example #1
0
        static void BuildXMPForRotationBias(string[] args)
        {
            string[] fileEntries = Directory.GetFiles(args[1]);
            foreach (string fileName in fileEntries)
            {
                string ext = Path.GetExtension(fileName);
                if (ext == ".xmp")
                {
                    XMPFile xmpFile = new XMPFile();
                    xmpFile.Load(fileName);
                    double[] rot     = xmpFile.rotation;
                    double[] new_rot = new double[9];

                    if (args[2] == "0")
                    {
                        //Right hand - 90 right turn
                        //Left hand - 90 left turn
                        new_rot[0] = -1.0 * rot[3];
                        new_rot[1] = -1.0 * rot[4];
                        new_rot[2] = -1.0 * rot[5];

                        new_rot[3] = rot[0];
                        new_rot[4] = rot[1];
                        new_rot[5] = rot[2];

                        new_rot[6] = rot[6];
                        new_rot[7] = rot[7];
                        new_rot[8] = rot[8];
                    }
                    if (args[2] == "1")
                    {
                        //Left hand - 90 right turn
                        //Right hand - 90 left turn
                        new_rot[0] = rot[3];
                        new_rot[1] = rot[4];
                        new_rot[2] = rot[5];

                        new_rot[3] = -1.0 * rot[0];
                        new_rot[4] = -1.0 * rot[1];
                        new_rot[5] = -1.0 * rot[2];

                        new_rot[6] = rot[6];
                        new_rot[7] = rot[7];
                        new_rot[8] = rot[8];
                    }

                    xmpFile.WriteRotation(new_rot);
                    xmpFile.Save();
                }
            }
        }