public static Double FittingError(
     Point2dCollection sourcePoints,
     Point2dCollection targetPoints,
     TransformMatrix2d transform)
 {
     return(0);
 }
        public static TransformMatrix2d BestFitTransformation(
            Point2dCollection sourcePoints,
            Point2dCollection targetPoints)
        {
            throw new NotImplementedException();

            /*
             * if (sourcePoints.Count != targetPoints.Count) throw new ArgumentException();
             *
             * DoubleMatrix c = new DoubleMatrix(3, 2);
             * for (int j = 0; j < 2; j++)
             *  for (int i = 0; i < 3; i++)
             *      for (int k = 0; k < sourcePoints.Count; k++)
             *      {
             *          DoubleMatrix qt = DoubleMatrix.JoinHorizontal(sourcePoints.Rows[k], DoubleMatrix.Identity(1));
             *          c[i, j] += qt[i, 0] * targetPoints[j, k];
             *      }
             *
             * DoubleMatrix Q = new DoubleMatrix(3, 3).Transposed;
             * foreach (DoubleMatrix rowMatrix in sourcePoints.Rows)
             * {
             *  DoubleMatrix qt = DoubleMatrix.JoinHorizontal(rowMatrix, DoubleMatrix.Identity(1));
             *  for (int i = 0; i < 3; i++)
             *      for (int j = 0; j < 3; j++)
             *      {
             *          Q[i, j] += qt[i, 0] * qt[j, 0];
             *      }
             * }
             *
             * DoubleMatrix M = DoubleMatrix.JoinVertical(Q, c).Transposed;
             *
             * DoubleMatrix reducedRow = DoubleMatrix.GaussianElimination(M);
             *
             * affineTransformationMatrix
             *  = reducedRow.SubMatrix(
             *      new Int32Range(dimension + 1, 2 * dimension),
             *      new Int32Range(0, dimension - 1));
             *
             * translationMatrix
             *  = reducedRow.SubMatrix(
             *      new Int32Range(dimension + 1, 2 * dimension),
             *      new Int32Range(dimension, dimension));
             */
        }
Beispiel #3
0
        /*
         * /// <summary>
         * ///
         * /// </summary>
         * /// <returns></returns>
         * public Point[] AsPointArray()
         * {
         *  Point[] points = new Point[this.Count];
         *  for (int j = 0; j < this.Count; j++)
         *      points[j] = this[j].AsPoint();
         *  return points;
         * }
         */

        #endregion Public Methods


        #region Public Static Methods
        /*************************/
        /* PUBLIC STATIC METHODS */
        /*************************/

        /// <summary>
        ///
        /// </summary>
        /// <param name="matrix"></param>
        /// <returns></returns>
        public static Point2dCollection FromMatrix(DoubleMatrix matrix)
        {
            if (matrix == null)
            {
                throw new ArgumentNullException("matrix");
            }
            if (matrix.ColumnCount != 3)
            {
                throw new DimensionMismatchException();
            }

            Point2dCollection collection = new Point2dCollection();

            foreach (DoubleMatrix row in matrix.Rows)
            {
                collection.Add(new Point2d(row));
            }

            return(collection);
        }