Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Boxi"/> using the specified location and size.
 /// </summary>
 /// <param name="x">Value for the X component of the box.</param>
 /// <param name="y">Value for the Y component of the box.</param>
 /// <param name="z">Value for the Z component of the box.</param>
 /// <param name="size">The size of the box.</param>
 public Boxi(int x, int y, int z, Size3i size)
 {
     X      = x;
     Y      = y;
     Z      = z;
     Width  = size.Width;
     Height = size.Height;
     Depth  = size.Depth;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Boxi"/> using the specified location and size.
 /// </summary>
 /// <param name="location">The front-lower-left corner of the box.</param>
 /// <param name="size">The size of the box.</param>
 public Boxi(Point3i location, Size3i size)
 {
     X      = location.X;
     Y      = location.Y;
     Z      = location.Z;
     Width  = size.Width;
     Height = size.Height;
     Depth  = size.Depth;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constrains each component to a given range.
 /// </summary>
 /// <param name="value">A size to constrain.</param>
 /// <param name="min">The minimum values for each component.</param>
 /// <param name="max">The maximum values for each component.</param>
 /// <returns>A size with each component constrained to the given range.</returns>
 public static Size3i Clamp(Size3i value, Size3i min, Size3i max)
 {
     return(new Size3i(Functions.Clamp(value.Width, min.Width, max.Width), Functions.Clamp(value.Height, min.Height, max.Height), Functions.Clamp(value.Depth, min.Depth, max.Depth)));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns a size that contains the highest value from each pair of components.
 /// </summary>
 /// <param name="value1">The first size.</param>
 /// <param name="value2">The second size.</param>
 /// <returns>The highest of each component in left and the matching component in right.</returns>
 public static Size3i Max(Size3i value1, Size3i value2)
 {
     return(new Size3i(Functions.Max(value1.Width, value2.Width), Functions.Max(value1.Height, value2.Height), Functions.Max(value1.Depth, value2.Depth)));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Transforms the components of a size and returns the result.
 /// </summary>
 /// <param name="value">The size to transform.</param>
 /// <param name="transformer">A transform function to apply to each component.</param>
 /// <returns>The result of transforming each component of value.</returns>
 public static Size3i Transform(Size3i value, Func <int, int> transformer)
 {
     return(new Size3i(transformer(value.Width), transformer(value.Height), transformer(value.Depth)));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Returns a value that indicates whether two sizes are equal.
 /// </summary>
 /// <param name="left">The first size to compare.</param>
 /// <param name="right">The second size to compare.</param>
 /// <returns>true if the left and right are equal; otherwise, false.</returns>
 public static bool Equals(Size3i left, Size3i right)
 {
     return(left == right);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Divides a size by a scalar and returns the result.
 /// </summary>
 /// <param name="size">The size to be divided (the dividend).</param>
 /// <param name="scalar">The scalar to divide by (the divisor).</param>
 /// <returns>The result of dividing left by right (the quotient).</returns>
 public static Size3i Divide(Size3i size, int scalar)
 {
     Contract.Requires(0 <= scalar);
     return(new Size3i(size.Width / scalar, size.Height / scalar, size.Depth / scalar));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Returns the product of a size and scalar.
 /// </summary>
 /// <param name="size">The size to multiply.</param>
 /// <param name="scalar">The scalar to multiply.</param>
 /// <returns>The product of the left and right parameters.</returns>
 public static Size3i Multiply(Size3i size, int scalar)
 {
     Contract.Requires(0 <= scalar);
     return(new Size3i(size.Width * scalar, size.Height * scalar, size.Depth * scalar));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Writes the given <see cref="Size3i"/> to an <see cref="Ibasa.IO.BinaryWriter">.
 /// </summary>
 public static void Write(this Ibasa.IO.BinaryWriter writer, Size3i size)
 {
     writer.Write(size.Width);
     writer.Write(size.Height);
     writer.Write(size.Depth);
 }