Esempio n. 1
0
        public static void WriteTestOutputVector3(string nameDisplayed, Matrix4 m, PointCloud mypointsSource, PointCloud myPointsTransformed, PointCloud myPointsTarget)
        {
            m.Print(nameDisplayed);

            long resultsWritten = mypointsSource.Vectors.Length;

            if (resultsWritten > 5)
            {
                resultsWritten = 5;
            }
            System.Diagnostics.Debug.WriteLine("Points:");
            double meanDistance = 0;

            for (int i = 0; i < resultsWritten; i++)
            {
                Vector3 pToBeMatched = mypointsSource.Vectors[i];
                Vector3 pTransformed = myPointsTransformed.Vectors[i];
                Vector3 pReference   = myPointsTarget.Vectors[i];

                string p1 = pToBeMatched[0].ToString("0.0") + " " + pToBeMatched[1].ToString("0.0") + " " + pToBeMatched[2].ToString("0.0");
                string p2 = pTransformed[0].ToString("0.0") + " " + pTransformed[1].ToString("0.0") + " " + pTransformed[2].ToString("0.0");
                string p3 = pReference[0].ToString("0.0") + " " + pReference[1].ToString("0.0") + " " + pReference[2].ToString("0.0");

                double distance = MathBase.DistanceBetweenVectors(pTransformed, pReference);
                meanDistance += distance;
                Debug.WriteLine(i.ToString() + " : " + p1 + " :transformed: " + p2 + " :target: " + p3 + " : Distance: " + distance.ToString("0.0"));
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // create a instance or objects of a class using new keyword
            MathNameSpace.MathBase x1 = new MathBase();
            Console.WriteLine("About: " + x1.AboutVariable);
            x1.AboutMethod();
            Console.WriteLine("add: " + x1.add(10, 10));
            Console.WriteLine("subtract: " + x1.subtract(10, 10));

            // multiple instances or objects of the same class
            MathBase x2 = new MathBase();

            Console.WriteLine("About: " + x2.AboutVariable);
            x2.AboutMethod();
            Console.WriteLine("add: " + x2.add(20, 20));
            Console.WriteLine("subtract: " + x2.subtract(20, 20));

            MathAdvance y = new MathAdvance();

            Console.WriteLine("About: " + y.AboutVariable);
            y.AboutMethod();
            int ylocal;

            ylocal = y.multiply(10, 10);
            Console.WriteLine("add: " + ylocal);
            Console.WriteLine("subtract: " + y.divide(10, 10));

            System.Console.WriteLine("system is root namespace of all namespaces");
            object z = y;

            System.Console.WriteLine("Object is root class of all classes");
        }
        public static void WriteTestOutputVertex(string nameDisplayed, Matrix4d m, List <Vertex> mypointsSource, List <Vertex> myPointsTransformed, List <Vertex> myPointsTarget)
        {
            WriteMatrix(nameDisplayed, m);

            long resultsWritten = mypointsSource.Count;

            if (resultsWritten > 5)
            {
                resultsWritten = 5;
            }
            System.Diagnostics.Debug.WriteLine("Points:");
            double meanDistance = 0;

            for (int i = 0; i < resultsWritten; i++)
            {
                Vector3d pToBeMatched = mypointsSource[i].Vector;
                Vector3d pTransformed = myPointsTransformed[i].Vector;
                Vector3d pReference   = myPointsTarget[i].Vector;

                string p1 = pToBeMatched[0].ToString("0.0") + " " + pToBeMatched[1].ToString("0.0") + " " + pToBeMatched[2].ToString("0.0");
                string p2 = pTransformed[0].ToString("0.0") + " " + pTransformed[1].ToString("0.0") + " " + pTransformed[2].ToString("0.0");
                string p3 = pReference[0].ToString("0.0") + " " + pReference[1].ToString("0.0") + " " + pReference[2].ToString("0.0");

                double distance = MathBase.DistanceBetweenVectors(pTransformed, pReference);
                meanDistance += distance;
                Debug.WriteLine(i.ToString() + " : " + p1 + " :transformed: " + p2 + " :target: " + p3 + " : Distance: " + distance.ToString("0.0"));
            }
            //Debug.WriteLine("--Mean Distance: " + (meanDistance / resultsWritten).ToString("0.0"));
        }
Esempio n. 4
0
        public static List <int> MultiplicatePolynomials(List <int> A, List <int> B)
        {
            int neededDegree = MathBase.FindUpperDegreeOf2(System.Math.Max(A.Count, B.Count));

            neededDegree <<= 1;        // equals neededDegree *= 2;

            var complexA = ComplexConverter.ConvertToComplexList(A, neededDegree);
            var complexB = ComplexConverter.ConvertToComplexList(B, neededDegree);

            complexA = MakeFFT(complexA);
            complexB = MakeFFT(complexB);

            for (int i = 0; i < neededDegree; i++)
            {
                complexA[i] *= complexB[i];
            }

            return(ComplexConverter.ConvertToIntList(MakeInverseFFT(complexA)));
        }