예제 #1
0
 public double clipXCollide(AxisAlignedBB c, double xa)
 {
     if (c.y1 <= this.y0 || c.y0 >= this.y1)
     {
         return(xa);
     }
     if (c.z1 <= this.z0 || c.z0 >= this.z1)
     {
         return(xa);
     }
     if (xa > 0.0f && c.x1 <= this.x0)
     {
         double max = this.x0 - c.x1 - this.epsilon;
         if (max < xa)
         {
             xa = max;
         }
     }
     if (xa < 0.0f && c.x0 >= this.x1)
     {
         double max = this.x1 - c.x0 + this.epsilon;
         if (max > xa)
         {
             xa = max;
         }
     }
     return(xa);
 }
예제 #2
0
 public double clipZCollide(AxisAlignedBB c, double za)
 {
     if (c.x1 <= this.x0 || c.x0 >= this.x1)
     {
         return(za);
     }
     if (c.y1 <= this.y0 || c.y0 >= this.y1)
     {
         return(za);
     }
     if (za > 0.0f && c.z1 <= this.z0)
     {
         double max = this.z0 - c.z1 - this.epsilon;
         if (max < za)
         {
             za = max;
         }
     }
     if (za < 0.0f && c.z0 >= this.z1)
     {
         double max = this.z1 - c.z0 + this.epsilon;
         if (max > za)
         {
             za = max;
         }
     }
     return(za);
 }
예제 #3
0
 public double clipYCollide(AxisAlignedBB c, double ya)
 {
     if (c.x1 <= this.x0 || c.x0 >= this.x1)
     {
         return(ya);
     }
     if (c.z1 <= this.z0 || c.z0 >= this.z1)
     {
         return(ya);
     }
     if (ya > 0.0f && c.y1 <= this.y0)
     {
         double max = this.y0 - c.y1 - this.epsilon;
         if (max < ya)
         {
             ya = max;
         }
     }
     if (ya < 0.0f && c.y0 >= this.y1)
     {
         double max = this.y1 - c.y0 + this.epsilon;
         if (max > ya)
         {
             ya = max;
         }
     }
     return(ya);
 }
예제 #4
0
 public bool intersects(AxisAlignedBB c)
 {
     return(c.x1 > this.x0 && c.x0 < this.x1 && c.y1 > this.y0 && c.y0 < this.y1 && c.z1 > this.z0 && c.z0 < this.z1);
 }