Exemplo n.º 1
0
 /// <summary>
 /// Compares two Vector instances for fuzzy equality.  This function
 /// helps compensate for the fact that double values can
 /// acquire error when operated upon
 /// </summary>
 /// <param name='vector1'>The first Vector to compare</param>
 /// <param name='vector2'>The second Vector to compare</param>
 /// <returns>Whether or not the two Vector instances are equal</returns>
 public static bool AreClose(System.Windows.Vector vector1, System.Windows.Vector vector2)
 {
     return(DoubleUtil.AreClose(vector1.X, vector2.X) &&
            DoubleUtil.AreClose(vector1.Y, vector2.Y));
 }
Exemplo n.º 2
0
        // The Point, Size, Rect and Matrix class have moved to WinCorLib.  However, we provide
        // internal AreClose methods for our own use here.

        /// <summary>
        /// Compares two Size instances for fuzzy equality.  This function
        /// helps compensate for the fact that double values can
        /// acquire error when operated upon
        /// </summary>
        /// <param name='size1'>The first size to compare</param>
        /// <param name='size2'>The second size to compare</param>
        /// <returns>Whether or not the two Size instances are equal</returns>
        public static bool AreClose(Size size1, Size size2)
        {
            return(DoubleUtil.AreClose(size1.Width, size2.Width) &&
                   DoubleUtil.AreClose(size1.Height, size2.Height));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Equality test against a <see cref="DpiScale"/> object.
 /// </summary>
 /// <param name="dpiScale">The object being compared against</param>
 /// <returns>True if the objects are equal, False otherwise</returns>
 public bool Equals(DpiScale dpiScale)
 {
     return
         (DoubleUtil.AreClose(this.DpiScaleX, dpiScale.DpiScaleX) &&
          DoubleUtil.AreClose(this.DpiScaleY, dpiScale.DpiScaleY));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Compares two points for fuzzy equality.  This function
 /// helps compensate for the fact that double values can
 /// acquire error when operated upon
 /// </summary>
 /// <param name='point1'>The first point to compare</param>
 /// <param name='point2'>The second point to compare</param>
 /// <returns>Whether or not the two points are equal</returns>
 public static bool AreClose(Point point1, Point point2)
 {
     return(DoubleUtil.AreClose(point1.X, point2.X) &&
            DoubleUtil.AreClose(point1.Y, point2.Y));
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Converts a location from an Avalon Point to a Win32 POINT
 /// </summary>
 /// <remarks>
 ///     Rounds "double" values to the nearest "int"
 /// </remarks>
 /// <param name="point">
 ///     The location as an Avalon Point
 /// </param>
 /// <returns>
 ///     The location as a Win32 POINT
 /// </returns>
 internal static NativeMethods.POINT FromPoint(Point point)
 {
     return(new NativeMethods.POINT(DoubleUtil.DoubleToInt(point.X), DoubleUtil.DoubleToInt(point.Y)));
 }