示例#1
0
        /// <summary>
        /// Generate a transform that transforms points in a space.
        /// </summary>
        /// <param name="fromPoints">
        /// The "from" points.
        /// </param>
        /// <param name="toPixels">
        /// The "to" points.
        /// </param>
        /// <returns>
        /// The 3x3 matrix that represents a transform from the points to the pixels.
        /// </returns>
        public static Matrix33 ComputeTransform(IList <Point> fromPoints, IList <Point> toPixels)
        {
            if (toPixels == null || fromPoints == null)
            {
                return(null);
            }

            var pixelMatrix = new Matrix33(toPixels);
            var pointMatrix = new Matrix33(fromPoints);

            return(pointMatrix.Inverse().Product(pixelMatrix));
        }
示例#2
0
        /// <summary>
        /// Generate a transform that transforms points in pc space to locations in map space.
        /// </summary>
        /// <param name="fromPoints">
        /// The "from" points, typically values from a ResourceDictionary entry.
        /// </param>
        /// <param name="toAnchors">
        /// The "to" anchors, typically map locations.
        /// </param>
        /// <returns>
        /// The 3x3 matrix that represents a transform from the points to the anchors.
        /// </returns>
        public static Matrix33 ComputeTransform(IList <Point> fromPoints, IList <ILocation> toAnchors)
        {
            if (toAnchors == null || fromPoints == null)
            {
                return(null);
            }

            var anchorMatrix = new Matrix33(toAnchors);
            var pointMatrix  = new Matrix33(fromPoints);

            return(pointMatrix.Inverse().Product(anchorMatrix));
        }