Exemplo n.º 1
0
 public static bool IsPointInsideAABB(Vector3 p, AxisAlignedBB b)
 {
     return
         (p.X >= b.MinX && p.X <= b.MaxX &&
          p.Y >= b.MinY && p.Y <= b.MaxY &&
          p.Z >= b.MinZ && p.Z <= b.MaxZ);
 }
Exemplo n.º 2
0
 public float IntersectionAmountZ(AxisAlignedBB aabb, bool checkIntersection)
 {
     if (checkIntersection)
     {
         if (!IntersectsAABBX(aabb) && !IntersectsAABBY(aabb))
         {
             return(0);
         }
     }
     if (MinZ < aabb.MaxZ && aabb.MinZ < MinZ)
     {
         return(aabb.MaxZ - MinZ);
     }
     if (MaxZ > aabb.MinZ && aabb.MinZ > MinZ)
     {
         return(MaxZ - aabb.MinZ);
     }
     return(0);
 }
Exemplo n.º 3
0
 public float IntersectionAmountY(AxisAlignedBB aabb, bool checkIntersection)
 {
     if (checkIntersection)
     {
         if (!IntersectsAABBX(aabb) && !IntersectsAABBZ(aabb))
         {
             return(0);
         }
     }
     if (MinY < aabb.MaxY && aabb.MinY < MinY)
     {
         return(aabb.MaxY - MinY);
     }
     if (MaxY > aabb.MinY && aabb.MinY > MinY)
     {
         return(MaxY - aabb.MinY);
     }
     return(0);
 }
Exemplo n.º 4
0
 public float IntersectionAmountX(AxisAlignedBB aabb, bool checkIntersection)
 {
     if (checkIntersection)
     {
         if (!IntersectsAABBY(aabb) && !IntersectsAABBZ(aabb))
         {
             return(0);
         }
     }
     if (MinX < aabb.MaxX && aabb.MinX < MinX)
     {
         return(aabb.MaxX - MinX);
     }
     if (MaxX > aabb.MinX && aabb.MinX > MinX)
     {
         return(MaxX - aabb.MinX);
     }
     return(0);
 }
Exemplo n.º 5
0
 public bool IntersectsAABB(AxisAlignedBB b)
 {
     return(IntersectsAABBX(b) && IntersectsAABBY(b) && IntersectsAABBZ(b));
 }
Exemplo n.º 6
0
 public bool IntersectsAABBZ(AxisAlignedBB aabb)
 {
     return(MinZ <= aabb.MaxZ && MaxZ >= aabb.MinZ);
 }
Exemplo n.º 7
0
 public bool IntersectsAABBY(AxisAlignedBB aabb)
 {
     return(MinY <= aabb.MaxY && MaxY >= aabb.MinY);
 }
Exemplo n.º 8
0
 public bool IntersectsAABBX(AxisAlignedBB aabb)
 {
     return(MinX <= aabb.MaxX && MaxX >= aabb.MinX);
 }