Пример #1
0
 public static Bounds3 <T> Intersect(Bounds3 <T> b1, Bounds3 <T> b2)
 {
     return(new Bounds3 <T>(
                new Point3 <T>(
                    Math.Max((dynamic)b1.Min.X, (dynamic)b2.Min.X),
                    Math.Max((dynamic)b1.Min.Y, (dynamic)b2.Min.Y),
                    Math.Max((dynamic)b1.Min.Z, (dynamic)b2.Min.Z)),
                new Point3 <T>(
                    Math.Min((dynamic)b1.Max.X, (dynamic)b2.Max.X),
                    Math.Min((dynamic)b1.Max.Y, (dynamic)b2.Max.Y),
                    Math.Min((dynamic)b1.Max.Z, (dynamic)b2.Max.Z))));
 }
Пример #2
0
 public Bounds3 <T> Union(Bounds3 <T> b)
 {
     return(new Bounds3 <T>(
                new Point3 <T>(
                    Math.Min((dynamic)Min.X, (dynamic)b.Min.X),
                    Math.Min((dynamic)Min.Y, (dynamic)b.Min.Y),
                    Math.Min((dynamic)Min.Z, (dynamic)b.Min.Z)),
                new Point3 <T>(
                    Math.Max((dynamic)Max.X, (dynamic)b.Max.X),
                    Math.Max((dynamic)Max.Y, (dynamic)b.Max.Y),
                    Math.Max((dynamic)Max.Z, (dynamic)b.Max.Z))));
 }
Пример #3
0
        public static Bounds3 <float> operator *(Transform t, Bounds3 <float> b)
        {
            var tb = new Bounds3 <float>(b.Min);

            tb = tb.Union(t * new Point3 <float>(b.Max.X, b.Min.Y, b.Min.Z));
            tb = tb.Union(t * new Point3 <float>(b.Min.X, b.Max.Y, b.Min.Z));
            tb = tb.Union(t * new Point3 <float>(b.Min.X, b.Min.Y, b.Max.Z));
            tb = tb.Union(t * new Point3 <float>(b.Min.X, b.Max.Y, b.Max.Z));
            tb = tb.Union(t * new Point3 <float>(b.Max.X, b.Max.Y, b.Min.Z));
            tb = tb.Union(t * new Point3 <float>(b.Max.X, b.Min.Y, b.Max.Z));
            tb = tb.Union(t * new Point3 <float>(b.Max.X, b.Max.Y, b.Max.Z));
            return(tb);
        }
Пример #4
0
 public static bool Overlaps(Bounds3 <T> b1, Bounds3 <T> b2)
 {
     return
         ((dynamic)b1.Max.X >= b2.Min.X && (dynamic)b1.Min.X <= b2.Max.X &&
          (dynamic)b1.Max.Y >= b2.Min.Y && (dynamic)b1.Min.Y <= b2.Max.Y);
 }