Example #1
0
        public static bool point_in_cube(GamePoint3D p, GamePoint3D d1, GamePoint3D d2)
        {
            GamePoint3D a1 = d1.Min(d2);
            GamePoint3D a2 = d2.Max(d1);

            return(p.X >= a1.X && p.X <= a2.X && p.Y >= a1.Y && p.Y <= a2.Y && p.Z >= a1.Z && p.Z <= a2.Z);
        }
Example #2
0
 public void getBoxWithSpeed(GamePoint3D d1, GamePoint3D d2, GamePoint3D spd, out GamePoint3D o1, out GamePoint3D o2)
 {
     o1 = d1.Min(d2);
     o2 = d2.Max(d1);
     if (spd.X > 0)
     {
         o2.X += spd.X;
     }
     else
     {
         o1.X += spd.X;
     }
     if (spd.Y > 0)
     {
         o2.Y += spd.Y;
     }
     else
     {
         o1.Y += spd.Y;
     }
     if (spd.Z > 0)
     {
         o2.Z += spd.Z;
     }
     else
     {
         o1.Z += spd.Z;
     }
 }
Example #3
0
        public static bool cube_in_cube(GamePoint3D s1, GamePoint3D s2, GamePoint3D d1, GamePoint3D d2)
        {
            GamePoint3D a1 = s1.Min(s2); //the switching isn't required, but it might smooth processing function in the long run
            GamePoint3D a2 = s2.Max(s1);
            GamePoint3D b1 = d1.Min(d2);
            GamePoint3D b2 = d2.Max(d1);

            return(a1.X < b2.X && a2.Y > b1.Y && a1.Y < b2.Y && a2.Y > b1.Y &&
                   a1.X < b2.X && a2.X > b1.X && a1.Z < b2.Z && a2.Z > b1.Z &&
                   a1.Y < b2.Y && a2.Y > b1.Y && a1.Z < b2.Z && a2.Z > b1.Z);
        }