Example #1
0
        public void PCA_Axes()
        {
            //this.pointCloudSource = ExamplePointClouds.CreateCube_RegularGrid_Empty(1);
            this.pointCloudSource = PointCloud.CreateCube_Corners_CenteredAt0(cubeSizeX);

            pointCloudSource.ResizeVerticesTo1();
            pca.PCA_OfPointCloud(pointCloudSource);

            //-----------Show in Window
            if (UIMode)
            {
                //
                //ShowResultsInWindow_Cube(true);
                //-----------Show in Window

                this.ShowResultsInWindow_CubeNew(true, true);
            }

            expectedResultCloud.AddVector(new Vector3(1, 0, 0));
            expectedResultCloud.AddVector(new Vector3(0, 1, 0));
            expectedResultCloud.AddVector(new Vector3(0, 0, 1));



            Assert.IsTrue(1e-3f > PointCloud.MeanDistance(expectedResultCloud, pointCloudSource.PCAAxesNormalized));
        }
Example #2
0
        public static float Test2_Identity(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult)
        {
            //mypointCloudTarget = Vertices.CreateSomePoints();
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(50);
            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);


            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
Example #3
0
        public static float Test5_CubeScale_Inhomogenous(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult)
        {
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(50);

            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);
            PointCloud.ScaleByVector(mypointCloudSource, new Vector3(1, 2, 3));

            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
Example #4
0
        public static float Test5_Cube8Shuffle(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult, float cubeSize)
        {
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(cubeSize);
            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);

            PointCloud.ShuffleTest(mypointCloudSource);

            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
Example #5
0
        public static float Test8_CubeOutliers_Translate(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult)
        {
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(20);
            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);
            PointCloud.Translate(mypointCloudSource, 0, -300, 0);
            PointCloud.CreateOutliers(mypointCloudSource, 5);


            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
Example #6
0
        public static float Test3_Scale(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult)
        {
            //mypointCloudTarget = CreateSomePoints();
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(50);

            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);

            PointCloud.ScaleByFactor(mypointCloudSource, 0.2f);

            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
        public void Cube_Delaunay_RandomPoints()
        {
            pointCloudSource = PointCloud.CreateCube_Corners_CenteredAt0(2);

            PointCloud.SetColorOfListTo(pointCloudSource, Color.Red);
            List <Vector3> myListVectors = pointCloudSource.ListVectors;

            DelaunayTri delaunay = new DelaunayTri(myListVectors);



            ShowPointCloud(pointCloudSource);
        }
Example #8
0
        public void CubeTranslated()
        {
            //-------------------
            pointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(1);
            pointCloudSource = pointCloudTarget.Clone();
            this.pointCloudSource.Translate(2, 0, 0);


            this.pointCloudResult = tree.BuildAndFindClosestPoints(pointCloudSource, pointCloudTarget, false);
            GlobalVariables.ShowLastTimeSpan("Search ");

            Assert.IsTrue(tree.MeanDistance <= 1.5f);
        }
Example #9
0
        public void Cube_ConvexHull()
        {
            pointCloudSource = PointCloud.CreateCube_Corners_CenteredAt0(0.1f);
            PointCloud.SetColorOfListTo(pointCloudSource, Color.Red);
            List <Vector3> myListVectors = pointCloudSource.ListVectors;

            ConvexHull3D convHull = new ConvexHull3D(myListVectors);



            ShowPointCloud(pointCloudSource);
            System.Diagnostics.Debug.WriteLine("Number of faces: " + convHull.Faces.ListFaces.Count.ToString());
        }
Example #10
0
        public static float Test2_RotationX30Degrees(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult)
        {
            //mypointCloudTarget = Vertices.CreateSomePoints();
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(50);
            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);

            Matrix3 R = Matrix3.CreateRotationX(30);

            PointCloud.Rotate(mypointCloudSource, R);


            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
Example #11
0
        public static float Test5_CubeRotate(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult)
        {
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(50);

            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);

            Matrix3 R = new Matrix3();

            R = R.RotationXYZDegrees(90, 124, -274);
            PointCloud.Rotate(mypointCloudSource, R);

            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }
Example #12
0
        public static float Test5_Cube8TranslateRotateShuffleNew(ref PointCloud mypointCloudTarget, ref PointCloud mypointCloudSource, ref PointCloud mypointCloudResult, float cubeSize)
        {
            mypointCloudTarget = PointCloud.CreateCube_Corners_CenteredAt0(cubeSize);

            mypointCloudSource = PointCloud.CloneAll(mypointCloudTarget);
            //PointCloud3D myPointCloud = ExamplePointClouds.Cuboid("Cuboid", 20f, 40f, 100, System.Drawing.Color.White, null);

            Matrix3 R = CreateAndPrintMatrix(65, -123, 35);

            PointCloud.Rotate(mypointCloudSource, R);
            PointCloud.Translate(mypointCloudSource, cubeSize * 1.2f, -cubeSize * 2.5f, cubeSize * 2);

            PointCloud.ShuffleTest(mypointCloudSource);

            mypointCloudResult = IterativeClosestPointTransform.Instance.PerformICP(mypointCloudSource, mypointCloudTarget);
            return(IterativeClosestPointTransform.Instance.MeanDistance);
        }