Axiom.Math.AxisAlignedBox.Merge C# (CSharp) Method

Merge() public method

Allows for merging two boxes together (combining).
public Merge ( AxisAlignedBox box ) : void
box AxisAlignedBox Source box.
return void
		public void Merge( AxisAlignedBox box )
		{
			if ( box.IsNull )
			{
				// nothing to merge with in this case, just return
				return;
			}
			else if ( box.IsInfinite )
			{
				this.IsInfinite = true;
			}
			else if ( this.IsNull )
			{
				SetExtents( box.Minimum, box.Maximum );
			}
			else if ( !this.IsInfinite )
			{
				minVector.Floor( box.Minimum );
				maxVector.Ceil( box.Maximum );

				UpdateCorners();
			}
		}

Same methods

AxisAlignedBox::Merge ( Vector3 point ) : void

Usage Example

Ejemplo n.º 1
0
        public void TestMergePoint()
        {
            AxisAlignedBox actual = new AxisAlignedBox( new Vector3(0,0,0), new Vector3(50,50,50));
            AxisAlignedBox expected = new AxisAlignedBox(new Vector3(0, 0, 0), new Vector3(150, 150, 150));

            Vector3 point = new Vector3(150, 150, 150);

            actual.Merge(point);

            Assert.AreEqual(expected, actual);
        }