Exemplo n.º 1
0
 public static Rect3D Union(Rect3D rect1, Rect3D rect2)
 {
     rect1.Union(rect2);
     return(rect1);
 }
Exemplo n.º 2
0
 public static Rect3D Union(Rect3D rect, Point3D point)
 {
     rect.Union(new Rect3D(point, point));
     return(rect);
 }
Exemplo n.º 3
0
/*		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();
		}
Exemplo n.º 4
0
 public static Rect3D Intersect(Rect3D rect1, Rect3D rect2)
 {
     rect1.Intersect(rect2);
     return(rect1);
 }
Exemplo n.º 5
0
		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;
		}
Exemplo n.º 6
0
		public bool Equals( Rect3D value )
		{
			return Equals( this, value );
		}
Exemplo n.º 7
0
		public static Rect3D Offset( Rect3D rect, Vector3D offsetVector )
		{
			rect.Offset( offsetVector._x, offsetVector._y, offsetVector._z );
			return rect;
		}
Exemplo n.º 8
0
 public bool Equals(Rect3D value)
 {
     return(Equals(this, value));
 }
Exemplo n.º 9
0
		public static Rect3D Union( Rect3D rect1, Rect3D rect2 )
		{
			rect1.Union( rect2 );
			return rect1;
		}
Exemplo n.º 10
0
		public static Rect3D Union( Rect3D rect, Point3D point )
		{
			rect.Union( new Rect3D( point, point ) );
			return rect;
		}
Exemplo n.º 11
0
		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;
			}
		}
Exemplo n.º 12
0
		public static Rect3D Intersect( Rect3D rect1, Rect3D rect2 )
		{
			rect1.Intersect( rect2 );
			return rect1;
		}
Exemplo n.º 13
0
		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;
			}
		}
Exemplo n.º 14
0
 public static Rect3D Offset(Rect3D rect, Vector3D offsetVector)
 {
     rect.Offset(offsetVector._x, offsetVector._y, offsetVector._z);
     return(rect);
 }
Exemplo n.º 15
0
		public static Rect3D Offset( Rect3D rect, double offsetX, double offsetY, double offsetZ )
		{
			rect.Offset( offsetX, offsetY, offsetZ );
			return rect;
		}
Exemplo n.º 16
0
 public static Rect3D Offset(Rect3D rect, double offsetX, double offsetY, double offsetZ)
 {
     rect.Offset(offsetX, offsetY, offsetZ);
     return(rect);
 }
Exemplo n.º 17
0
		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;
		}
Exemplo n.º 18
0
/*		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();
        }
Exemplo n.º 19
0
		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;
		}