public static AreClose ( Point point1, Point point2 ) : bool | ||
point1 | Point | The first point to compare |
point2 | Point | The second point to compare |
return | bool |
public static bool AreClose(Rect rect1, Rect rect2) { if (rect1.IsEmpty) { return(rect2.IsEmpty); } if (!rect2.IsEmpty && DoubleUtil.AreClose(rect1.X, rect2.X) && (DoubleUtil.AreClose(rect1.Y, rect2.Y) && DoubleUtil.AreClose(rect1.Height, rect2.Height))) { return(DoubleUtil.AreClose(rect1.Width, rect2.Width)); } return(false); }
/// <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)); }
// 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 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)); }
/// <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)); }
/// <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)); }