Beispiel #1
0
 /// <summary> Determine if and only if A partially contains B </summary>
 public static bool IsIntersecting(Bounds4 a, Bounds4 b)
 {
     return(b.max > a.min && b.min < a.max);
 }
Beispiel #2
0
 /// <summary> Compare which Bounds4 is the closest. Positive means L is closer </summary>
 public static float Compare(Vector4 center, Bounds4 l, Bounds4 r)
 {
     return(Vector4.DistanceSq(r.Clamp(center), center) - Vector4.DistanceSq(l.Clamp(center), center));
 }
Beispiel #3
0
        /// <summary> Scales the bound's extent </summary>
        public static Bounds4 Scale(Bounds4 b, Vector4 s)
        {
            Vector4 c = b.center, e = b.extent * s;

            return(new Bounds4(c - e, c + e));
        }
Beispiel #4
0
 /// <summary> Intersect two bounds </summary>
 public static Bounds4 Intersect(Bounds4 a, Bounds4 b)
 {
     return(new Bounds4(Vector4.Max(a.min, b.min), Vector4.Min(a.max, b.max)));
 }
Beispiel #5
0
 /// <summary> Is this bound contains the whole cell of the other bound? </summary>
 public bool Contains(Bounds4 other)
 {
     return(min < other.min && max > other.max);
 }
Beispiel #6
0
 /// <summary>
 /// Create a sphere from box bounding
 /// </summary>
 public SphereBounds4(Bounds4 bound)
 {
     center = bound.center;
     radius = Vector4.MaxPerElem(bound.extent);
 }