Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static bool Intersects(ref Bounds3 left, ref Bounds3 right)
 {
     return
         (((left.Minimum.X <= right.Minimum.X && right.Minimum.X <= left.Maximum.X) || (right.Minimum.X <= left.Minimum.X && left.Minimum.X <= right.Maximum.X)) &&
          ((left.Minimum.Y <= right.Minimum.Y && right.Minimum.Y <= left.Maximum.Y) || (right.Minimum.Y <= left.Minimum.Y && left.Minimum.Y <= right.Maximum.Y)) &&
          ((left.Minimum.Z <= right.Minimum.Z && right.Minimum.Z <= left.Maximum.Z) || (right.Minimum.Z <= left.Minimum.Z && left.Minimum.Z <= right.Maximum.Z)));
 }
Beispiel #2
0
        public static Bounds3 Expand(Bounds3 bounds, float scale, Vector3 center)
        {
            var minimum = (bounds.Minimum - center) * scale + center;
            var maximum = (bounds.Maximum - center) * scale + center;

            return(new Bounds3(minimum, maximum));
        }
Beispiel #3
0
 public static bool Contains(ref Bounds3 container, ref Bounds3 bounds)
 {
     return
         ((bounds.Minimum.X >= container.Minimum.X && bounds.Maximum.X <= container.Maximum.X) &&
          (bounds.Minimum.Y >= container.Minimum.Y && bounds.Maximum.Y <= container.Maximum.Y) &&
          (bounds.Minimum.Z >= container.Minimum.Z && bounds.Maximum.Z <= container.Maximum.Z));
 }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bounds"></param>
 /// <param name="vector"></param>
 /// <returns></returns>
 public static bool Contains(ref Bounds3 bounds, ref Vector3 vector)
 {
     return
         ((vector.X >= bounds.Minimum.X && vector.X <= bounds.Maximum.X) &&
          (vector.Y >= bounds.Minimum.Y && vector.Y <= bounds.Maximum.Y) &&
          (vector.Z >= bounds.Minimum.Z && vector.Z <= bounds.Maximum.Z));
 }
Beispiel #5
0
 /// <summary>
 /// Normalizes the bounds and ensures that the maximum values and minimum values are in the right place.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static Bounds3 Normalize(Bounds3 value)
 {
     return(new Bounds3(
                Math.Min(value.Minimum.X, value.Maximum.X), Math.Max(value.Minimum.X, value.Maximum.X),
                Math.Min(value.Minimum.Y, value.Maximum.Y), Math.Max(value.Minimum.Y, value.Maximum.Y),
                Math.Min(value.Minimum.Z, value.Maximum.Z), Math.Max(value.Minimum.Z, value.Maximum.Z)));
 }
Beispiel #6
0
 /// <summary>
 /// Determines if the specified bounds intersects with this Bounds3 structure.
 /// </summary>
 /// <param name="bounds"></param>
 /// <returns></returns>
 public bool Intersects(Bounds3 bounds) => Intersects(ref this, ref bounds);
Beispiel #7
0
 public bool Contains(Bounds3 bounds) => Contains(ref this, ref bounds);
Beispiel #8
0
 public static Bounds3 ExpandFromOrigin(Bounds3 bounds, float scale)
 {
     return(new Bounds3(bounds.Minimum * scale, bounds.Maximum * scale));
 }