示例#1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="box"></param>
 public BoundingBox(BoundingBox box)
     : this(box.pMin, box.pMax)
 {
 }
示例#2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="b"></param>
 /// <param name="b2"></param>
 /// <returns></returns>
 public static BoundingBox Union(BoundingBox b, BoundingBox b2)
 {
     var ret = new BoundingBox(b);
     ret.pMin.x = Math.Min (b.pMin.x, b2.pMin.x);
     ret.pMin.y = Math.Min (b.pMin.y, b2.pMin.y);
     ret.pMin.z = Math.Min (b.pMin.z, b2.pMin.z);
     ret.pMax.x = Math.Max (b.pMax.x, b2.pMax.x);
     ret.pMax.y = Math.Max (b.pMax.y, b2.pMax.y);
     ret.pMax.z = Math.Max (b.pMax.z, b2.pMax.z);
     return ret;
 }
示例#3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public bool Overlaps(BoundingBox b)
        {
            var x = (this.pMax.x >= b.pMin.x) && (this.pMin.x <= b.pMax.x);
            var y = (this.pMax.y >= b.pMin.y) && (this.pMin.y <= b.pMax.y);
            var z = (this.pMax.z >= b.pMin.z) && (this.pMin.z <= b.pMax.z);

            return (x && y && z);
        }
示例#4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="b"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static BoundingBox Union(BoundingBox b, Point p)
        {
            var ret = new BoundingBox(b);

            ret.pMin.x = Math.Min (b.pMin.x, p.x);
            ret.pMin.y = Math.Min (b.pMin.y, p.y);
            ret.pMin.z = Math.Min (b.pMin.z, p.z);
            ret.pMax.x = Math.Max (b.pMax.x, p.x);
            ret.pMax.y = Math.Max (b.pMax.y, p.y);
            ret.pMax.z = Math.Max (b.pMax.z, p.z);

            return ret;
        }