AxisAlignedBB: Use elseif in calculate*Offset()

It's impossible for both of these conditions to be met in the same call.
This commit is contained in:
Dylan K. Taylor 2017-12-26 14:31:42 +00:00
parent 3c4dca7fdb
commit dda71b06ae

View File

@ -226,8 +226,7 @@ class AxisAlignedBB{
if($x1 < $x){ if($x1 < $x){
$x = $x1; $x = $x1;
} }
} }elseif($x < 0 and $bb->minX >= $this->maxX){
if($x < 0 and $bb->minX >= $this->maxX){
$x2 = $this->maxX - $bb->minX; $x2 = $this->maxX - $bb->minX;
if($x2 > $x){ if($x2 > $x){
$x = $x2; $x = $x2;
@ -249,8 +248,7 @@ class AxisAlignedBB{
if($y1 < $y){ if($y1 < $y){
$y = $y1; $y = $y1;
} }
} }elseif($y < 0 and $bb->minY >= $this->maxY){
if($y < 0 and $bb->minY >= $this->maxY){
$y2 = $this->maxY - $bb->minY; $y2 = $this->maxY - $bb->minY;
if($y2 > $y){ if($y2 > $y){
$y = $y2; $y = $y2;
@ -272,8 +270,7 @@ class AxisAlignedBB{
if($z1 < $z){ if($z1 < $z){
$z = $z1; $z = $z1;
} }
} }elseif($z < 0 and $bb->minZ >= $this->maxZ){
if($z < 0 and $bb->minZ >= $this->maxZ){
$z2 = $this->maxZ - $bb->minZ; $z2 = $this->maxZ - $bb->minZ;
if($z2 > $z){ if($z2 > $z){
$z = $z2; $z = $z2;