示例#1
0
        public static double Test6_Bunny_ExpectedError(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory + "TestData";

            Model3D model3DTarget = new Model3D(path + "\\bunny.obj");

            myVerticesTarget = model3DTarget.VertexList;
            Vertices.GetVertexMax(myVerticesTarget);

            myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget);



            Matrix3d R = new Matrix3d();

            //ICP converges with a rotation of
            //R = R.RotationXYZ(60, 60, 60);
            R = R.RotationXYZ(65, 65, 65);


            VertexUtils.RotateVertices(myVerticesSource, R);


            myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource);

            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
示例#2
0
        public static double Test5_CubeRotate(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult)
        {
            myVerticesTarget = Vertices.CreateCube_Corners(50);

            myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget);

            Matrix3d R = new Matrix3d();

            R = R.RotateSome();
            VertexUtils.RotateVertices(myVerticesSource, R);

            myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
示例#3
0
        public static double Test2_RotationX30Degrees(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult)
        {
            //myVerticesTarget = Vertices.CreateSomePoints();
            myVerticesTarget = Vertices.CreateCube_Corners(50);
            myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget);

            Matrix3d R = Matrix3d.CreateRotationX(30);

            VertexUtils.RotateVertices(myVerticesSource, R);


            myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
示例#4
0
        public static double Test5_CubeRotateTranslate_ScaleInhomogenous(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult)
        {
            myVerticesTarget = Vertices.CreateCube_Corners(50);

            myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget);

            VertexUtils.TranslateVertices(myVerticesSource, 0, 0, 149);
            VertexUtils.ScaleByVector(myVerticesSource, new Vertex(1, 2, 3));

            Matrix3d R = new Matrix3d();

            R = R.RotateSome();
            VertexUtils.RotateVertices(myVerticesSource, R);

            myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
示例#5
0
        public static double Test8_CubeOutliers_Rotate(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult)
        {
            //myVerticesTarget = Vertices.CreateCube_Corners(50);
            Model3D myModel = Example3DModels.Cuboid("Cuboid", 20f, 40f, 100, new Vector3d(1, 1, 1), null);

            myVerticesTarget = myModel.VertexList;

            myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget);
            Matrix3d R = new Matrix3d();

            R = R.Rotation30Degrees();
            VertexUtils.RotateVertices(myVerticesSource, R);

            VertexUtils.CreateOutliers(myVerticesSource, 5);


            myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
示例#6
0
        public static double Test7_Face_KnownTransformation(ref List <Vertex> myVerticesTarget, ref List <Vertex> myVerticesSource, ref List <Vertex> myVerticesResult)
        {
            string  path          = AppDomain.CurrentDomain.BaseDirectory + "TestData";
            Model3D model3DTarget = new Model3D(path + "\\KinectFace1.obj");

            myVerticesTarget = model3DTarget.VertexList;
            Vertices.GetVertexMax(myVerticesTarget);


            myVerticesSource = VertexUtils.CloneListVertex(myVerticesTarget);


            VertexUtils.ScaleByFactor(myVerticesSource, 0.9);
            Matrix3d R = new Matrix3d();

            R = R.Rotation60Degrees();
            VertexUtils.RotateVertices(myVerticesSource, R);
            VertexUtils.TranslateVertices(myVerticesSource, 0.3, 0.5, -0.4);


            myVerticesResult = IterativeClosestPointTransform.Instance.PerformICP(myVerticesTarget, myVerticesSource);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }