public static Rect3D Union(Rect3D rect1, Rect3D rect2) { rect1.Union(rect2); return(rect1); }
public static Rect3D Union(Rect3D rect, Point3D point) { rect.Union(new Rect3D(point, point)); return(rect); }
/* public static Rect3D Parse( string source ) { Rect3D empty; IFormatProvider cultureInfo = CultureInfo.GetCultureInfo( "en-us" ); TokenizerHelper helper = new TokenizerHelper( source, cultureInfo ); string str = helper.NextTokenRequired(); if ( str == "Empty" ) { empty = Empty; } else { empty = new Rect3D( Convert.ToDouble( str, cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ) ); } helper.LastTokenRequired(); return empty; } public override string ToString() { return this.ConvertToString( null, null ); } public string ToString( IFormatProvider provider ) { return this.ConvertToString( null, provider ); } string IFormattable.ToString( string format, IFormatProvider provider ) { return this.ConvertToString( format, provider ); } internal string ConvertToString( string format, IFormatProvider provider ) { if ( this.IsEmpty ) { return "Empty"; } char numericListSeparator = TokenizerHelper.GetNumericListSeparator( provider ); return string.Format( provider, "{1:" + format + "}{0}{2:" + format + "}{0}{3:" + format + "}{0}{4:" + format + "}{0}{5:" + format + "}{0}{6:" + format + "}", new object[] { numericListSeparator, this._x, this._y, this._z, this._sizeX, this._sizeY, this._sizeZ } ); } */ static Rect3D() { Infinite = CreateInfiniteRect3D(); s_empty = CreateEmptyRect3D(); }
public static Rect3D Intersect(Rect3D rect1, Rect3D rect2) { rect1.Intersect(rect2); return(rect1); }
public bool IntersectsWith( Rect3D rect ) { if ( ( !this.IsEmpty && !rect.IsEmpty ) && ( ( ( ( rect._x <= ( this._x + this._sizeX ) ) && ( ( rect._x + rect._sizeX ) >= this._x ) ) && ( ( rect._y <= ( this._y + this._sizeY ) ) && ( ( rect._y + rect._sizeY ) >= this._y ) ) ) && ( rect._z <= ( this._z + this._sizeZ ) ) ) ) { return ( ( rect._z + rect._sizeZ ) >= this._z ); } return false; }
public bool Equals( Rect3D value ) { return Equals( this, value ); }
public static Rect3D Offset( Rect3D rect, Vector3D offsetVector ) { rect.Offset( offsetVector._x, offsetVector._y, offsetVector._z ); return rect; }
public bool Equals(Rect3D value) { return(Equals(this, value)); }
public static Rect3D Union( Rect3D rect1, Rect3D rect2 ) { rect1.Union( rect2 ); return rect1; }
public static Rect3D Union( Rect3D rect, Point3D point ) { rect.Union( new Rect3D( point, point ) ); return rect; }
public void Union( Rect3D rect ) { if ( this.IsEmpty ) { this = rect; } else if ( !rect.IsEmpty ) { double num3 = Math.Min( this._x, rect._x ); double num2 = Math.Min( this._y, rect._y ); double num = Math.Min( this._z, rect._z ); this._sizeX = Math.Max( (double)( this._x + this._sizeX ), (double)( rect._x + rect._sizeX ) ) - num3; this._sizeY = Math.Max( (double)( this._y + this._sizeY ), (double)( rect._y + rect._sizeY ) ) - num2; this._sizeZ = Math.Max( (double)( this._z + this._sizeZ ), (double)( rect._z + rect._sizeZ ) ) - num; this._x = num3; this._y = num2; this._z = num; } }
public static Rect3D Intersect( Rect3D rect1, Rect3D rect2 ) { rect1.Intersect( rect2 ); return rect1; }
public void Intersect( Rect3D rect ) { if ( ( this.IsEmpty || rect.IsEmpty ) || !this.IntersectsWith( rect ) ) { this = Empty; } else { double num3 = Math.Max( this._x, rect._x ); double num2 = Math.Max( this._y, rect._y ); double num = Math.Max( this._z, rect._z ); this._sizeX = Math.Min( (double)( this._x + this._sizeX ), (double)( rect._x + rect._sizeX ) ) - num3; this._sizeY = Math.Min( (double)( this._y + this._sizeY ), (double)( rect._y + rect._sizeY ) ) - num2; this._sizeZ = Math.Min( (double)( this._z + this._sizeZ ), (double)( rect._z + rect._sizeZ ) ) - num; this._x = num3; this._y = num2; this._z = num; } }
public static Rect3D Offset(Rect3D rect, Vector3D offsetVector) { rect.Offset(offsetVector._x, offsetVector._y, offsetVector._z); return(rect); }
public static Rect3D Offset( Rect3D rect, double offsetX, double offsetY, double offsetZ ) { rect.Offset( offsetX, offsetY, offsetZ ); return rect; }
public static Rect3D Offset(Rect3D rect, double offsetX, double offsetY, double offsetZ) { rect.Offset(offsetX, offsetY, offsetZ); return(rect); }
public static bool Equals( Rect3D rect1, Rect3D rect2 ) { if ( rect1.IsEmpty ) { return rect2.IsEmpty; } if ( ( ( rect1.X.Equals( rect2.X ) && rect1.Y.Equals( rect2.Y ) ) && ( rect1.Z.Equals( rect2.Z ) && rect1.SizeX.Equals( rect2.SizeX ) ) ) && rect1.SizeY.Equals( rect2.SizeY ) ) { return rect1.SizeZ.Equals( rect2.SizeZ ); } return false; }
/* public static Rect3D Parse( string source ) * { * Rect3D empty; * IFormatProvider cultureInfo = CultureInfo.GetCultureInfo( "en-us" ); * TokenizerHelper helper = new TokenizerHelper( source, cultureInfo ); * string str = helper.NextTokenRequired(); * if ( str == "Empty" ) * { * empty = Empty; * } * else * { * empty = new Rect3D( Convert.ToDouble( str, cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ), Convert.ToDouble( helper.NextTokenRequired(), cultureInfo ) ); * } * helper.LastTokenRequired(); * return empty; * } * * public override string ToString() * { * return this.ConvertToString( null, null ); * } * * public string ToString( IFormatProvider provider ) * { * return this.ConvertToString( null, provider ); * } * * string IFormattable.ToString( string format, IFormatProvider provider ) * { * return this.ConvertToString( format, provider ); * } * * internal string ConvertToString( string format, IFormatProvider provider ) * { * if ( this.IsEmpty ) * { * return "Empty"; * } * char numericListSeparator = TokenizerHelper.GetNumericListSeparator( provider ); * return string.Format( provider, "{1:" + format + "}{0}{2:" + format + "}{0}{3:" + format + "}{0}{4:" + format + "}{0}{5:" + format + "}{0}{6:" + format + "}", new object[] { numericListSeparator, this._x, this._y, this._z, this._sizeX, this._sizeY, this._sizeZ } ); * } */ static Rect3D() { Infinite = CreateInfiniteRect3D(); s_empty = CreateEmptyRect3D(); }
public bool Contains( Rect3D rect ) { if ( ( !this.IsEmpty && !rect.IsEmpty ) && ( ( ( ( this._x <= rect._x ) && ( this._y <= rect._y ) ) && ( ( this._z <= rect._z ) && ( ( this._x + this._sizeX ) >= ( rect._x + rect._sizeX ) ) ) ) && ( ( this._y + this._sizeY ) >= ( rect._y + rect._sizeY ) ) ) ) { return ( ( this._z + this._sizeZ ) >= ( rect._z + rect._sizeZ ) ); } return false; }