/// <summary>
 /// Create a new list log message from an actual log message.
 /// </summary>
 /// <param name="pLogMessage"></param>
 public LogMessage(UbiDisplays.Model.Log.LogMessage pLogMessage)
 {
     Message = pLogMessage.Message;
     Source = pLogMessage.Source;
     Type = pLogMessage.LogType;
     Time = pLogMessage.Time;
 }
        /// <summary>
        /// Find the closest corner on a surface in projector space.
        /// </summary>
        /// <param name="pPoint">The point relative to the image.  This function will transform this point into projector space.</param>
        /// <param name="pSelected">The destination for the selected surface, should one be found.</param>
        /// <param name="iClosestCorner">The corner index closest to the point on the selected surface, should one be found.</param>
        /// <param name="fThreshold">The threshold value for checking if we should disregard the corner entirely.</param>
        /// <returns>True if a corner was found, false if not.</returns>
        private bool FindClosestSurfaceAndCorner(Point pPoint, out UbiDisplays.Model.Surface pSelected, out int iClosestCorner, double fThreshold = 0.1)
        {
            // Look through each surface and try to find one with a close corner.
            double fSmallest = double.PositiveInfinity;

            // Set default values.
            pSelected = null;
            iClosestCorner = -1;

            // Corner vector.
            var pProjector = pHomography.Transform((float)pPoint.X, (float)pPoint.Y);
            var vProjector = new Vector(pProjector.X, pProjector.Y);

            // For each surface.
            foreach (var s in Authority.Surfaces)
            {
                // Look through each corner to see how close it is to this point.
                for (int i = 0, n = 4; i < n; ++i)
                {
                    Point tCorner = s.ProjectorSpace[i];
                    double fDistance = Vector.Subtract(vProjector, new Vector(tCorner.X, tCorner.Y)).Length;
                    if (fDistance < fSmallest && fDistance < fThreshold)
                    {
                        fSmallest = fDistance;
                        iClosestCorner = i;
                        pSelected = s;
                    }
                }
            }

            // Say if we found a corner.
            return (iClosestCorner != -1);
        }