/// <summary> /// Compares two points. /// </summary> /// <param name="point1">The first point.</param> /// <param name="point2">The second point.</param> public static bool IsEqual(Point point1, Point point2) { double DiffX = Math.Abs((point2.X - point1.X).Draw); double DiffY = Math.Abs((point2.Y - point1.Y).Draw); return(RegionHelper.IsZero(DiffX) && RegionHelper.IsZero(DiffY)); }
/// <summary> /// Compares two regions. /// </summary> /// <param name="rect1">The first region.</param> /// <param name="rect2">The second region.</param> public static bool IsEqual(Rect rect1, Rect rect2) { double DiffX = Math.Abs(rect2.X - rect1.X); double DiffY = Math.Abs(rect2.Y - rect1.Y); double DiffCX = Math.Abs(rect2.Width - rect1.Width); double DiffCY = Math.Abs(rect2.Height - rect1.Height); return(RegionHelper.IsZero(DiffX) && RegionHelper.IsZero(DiffY) && RegionHelper.IsZero(DiffCX) && RegionHelper.IsZero(DiffCY)); }
/// <summary> /// Compares two sizes. Stretched sizes are never equal, even to themselves. /// </summary> /// <param name="size1">The first size.</param> /// <param name="size2">The second size.</param> public static bool IsEqual(Size size1, Size size2) { double DiffCX = size1.Width.IsFloating && size2.Width.IsFloating ? 0 : Math.Abs((size2.Width - size1.Width).Draw); double DiffCY = size1.Height.IsFloating && size2.Height.IsFloating ? 0 : Math.Abs((size2.Height - size1.Height).Draw); Debug.Assert(!double.IsNaN(DiffCX) && !double.IsNaN(DiffCY)); return(RegionHelper.IsZero(DiffCX) && RegionHelper.IsZero(DiffCY)); }