public void Test_CollectTrueCorrespondences(string file, CorrespondenceCollection expected)
        {
            _TransformationComputer computer = new _TransformationComputer(InputPath(file));

            computer.ReadObjFile();
            computer.CollectCorrespondences();

            CorrespondenceCollection actual = computer.Correspondences;

            Assert.AreEqual(expected, actual);
        }
        public void Test_ComputeTransformationMatrix(string file, Matrix4x4 expected)
        {
            _TransformationComputer computer = new _TransformationComputer(InputPath(file));

            computer.ReadObjFile();
            computer.CollectCorrespondences();
            computer.ComputeTransformationMatrix();

            Matrix4x4 actual = computer.TransformationMatrix;

            for (int i = 0; i < 16; i++)
            {
                Assert.That(expected[i], Is.EqualTo(actual[i]).Within(precision));
            }
        }
        public void Test_ExtractRotationAndTranslation(string file, Vector3 expectedActualTranslation, Quaternion expectedActualRotation)
        {
            _TransformationComputer computer = new _TransformationComputer(InputPath(file));

            computer.ReadObjFile();
            computer.CollectCorrespondences();
            computer.ComputeTransformationMatrix();
            computer.ExtractTranslationAndRotation();

            StatisticsComputer.RunResult actual = computer.Run;

            Assert.IsTrue(actual.ActualTranslation == expectedActualTranslation);

            float deltaAngle = Quaternion.Angle(actual.ActualRotation, expectedActualRotation);

            Assert.That(deltaAngle, Is.EqualTo(0).Within(0.1f));
        }
Пример #4
0
    public IEnumerator <object> Compute(StatisticsComputer.RunResult run)
    {
        this.done = false;

        transformComputer = new _TransformationComputer(run);
        yield return(null);

        transformComputer.ReadObjFile();
        yield return(null);

        transformComputer.CollectCorrespondences();
        yield return(null);

        transformComputer.ComputeTransformationMatrix();
        yield return(null);

        transformComputer.ExtractTranslationAndRotation();
        yield return(null);

        this.done = true;
    }