idTech4.idBounds.FromBoundsTranslation C# (CSharp) Method

FromBoundsTranslation() public static method

Most tight bounds for the translational movement of the given bounds.
public static FromBoundsTranslation ( idBounds bounds, Vector3 origin, Matrix axis, Vector3 translation ) : idBounds
bounds idBounds
origin Vector3
axis Matrix
translation Vector3
return idBounds
		public static idBounds FromBoundsTranslation(idBounds bounds, Vector3 origin, Matrix axis, Vector3 translation)
		{
			idBounds result;

			if(axis != Matrix.Identity)
			{
				result = FromTransformedBounds(bounds, origin, axis);
			}
			else
			{
				result = new idBounds(bounds.Min + origin, bounds.Max + origin);
			}

			if(translation.X < 0.0f)
			{
				bounds.Min.X += translation.X;
			}
			else
			{
				bounds.Max.X += translation.X;
			}

			if(translation.Y < 0.0f)
			{
				bounds.Min.Y += translation.Y;
			}
			else
			{
				bounds.Max.Y += translation.Y;
			}

			if(translation.Z < 0.0f)
			{
				bounds.Min.Z += translation.Z;
			}
			else
			{
				bounds.Max.Z += translation.Z;
			}

			return bounds;
		}