//------------------------------------------------------ // // Constructors // //------------------------------------------------------ /// <summary> /// Constructor which sets the initial values to the values of the parameters. /// </summary> /// <param name="location">Location of the new rectangle.</param> /// <param name="size">Size of the new rectangle.</param> public Rect3D(Point3D location, Size3D size) { if (size.IsEmpty) { this = s_empty; } else { _x = location._x; _y = location._y; _z = location._z; _sizeX = size._x; _sizeY = size._y; _sizeZ = size._z; } Debug.Assert(size.IsEmpty == IsEmpty); }
/// <summary> /// Equals - compares this Size3D with the passed in object. In this equality /// Double.NaN is equal to itself, unlike in numeric equality. /// Note that double values can acquire error when operated upon, such that /// an exact comparison between two values which /// are logically equal may fail. /// </summary> /// <returns> /// bool - true if "value" is equal to "this". /// </returns> /// <param name='value'>The Size3D to compare to "this"</param> public bool Equals(Size3D value) { return Size3D.Equals(this, value); }
/// <summary> /// Compares two Size3D instances for object equality. In this equality /// Double.NaN is equal to itself, unlike in numeric equality. /// Note that double values can acquire error when operated upon, such that /// an exact comparison between two values which /// are logically equal may fail. /// </summary> /// <returns> /// bool - true if the two Size3D instances are exactly equal, false otherwise /// </returns> /// <param name='size1'>The first Size3D to compare</param> /// <param name='size2'>The second Size3D to compare</param> public static bool Equals(Size3D size1, Size3D size2) { if (size1.IsEmpty) { return size2.IsEmpty; } else { return size1.X.Equals(size2.X) && size1.Y.Equals(size2.Y) && size1.Z.Equals(size2.Z); } }
private static Size3D CreateEmptySize3D() { Size3D empty = new Size3D(); // Can't use setters because they throw on negative values empty._x = Double.NegativeInfinity; empty._y = Double.NegativeInfinity; empty._z = Double.NegativeInfinity; return empty; }
/// <summary> /// Equals - compares this Size3D with the passed in object. In this equality /// Double.NaN is equal to itself, unlike in numeric equality. /// Note that double values can acquire error when operated upon, such that /// an exact comparison between two values which /// are logically equal may fail. /// </summary> /// <returns> /// bool - true if "value" is equal to "this". /// </returns> /// <param name='value'>The Size3D to compare to "this"</param> public bool Equals(Size3D value) { return(Size3D.Equals(this, value)); }