Exemple #1
0
 /// <summary>
 /// Assigns the components using the coresponding faces
 /// </summary>
 /// <param name="cuboidComponents">The face of the box. Can not use a mix of bit flags</param>
 /// <param name="values">The value to assign</param>
 /// <returns>A new cuboid with a mix of new and original values, based on if each bit-flag of faces was set.</returns>
 public Cuboid SetComponents(CuboidComponents cuboidComponents, Cuboid values)
 {
     return(new Cuboid(
                cuboidComponents.Any(CuboidComponents.Left) ? values.Left : Left,
                cuboidComponents.Any(CuboidComponents.Bottom) ? values.Bottom : Bottom,
                cuboidComponents.Any(CuboidComponents.Forward) ? values.Forward : Forward,
                cuboidComponents.Any(CuboidComponents.Length) ? values.Length : Length,
                cuboidComponents.Any(CuboidComponents.Height) ? values.Height : Height,
                cuboidComponents.Any(CuboidComponents.Width) ? values.Width : Width));
 }
Exemple #2
0
 public static bool Within(this Cuboid cuboid, Point3 position)
 {
     return(position.X >= cuboid.Left && position.X < cuboid.Left + cuboid.Length &&
            position.Y >= cuboid.Bottom && position.Y < cuboid.Bottom + cuboid.Height &&
            position.Z >= cuboid.Forward && position.Z < cuboid.Forward + cuboid.Width);
 }