Skip to content

Commit 296683e

Browse files
committed
[GEN] Backport fix for float division by zero in obb_separation_test function from Zero Hour (#772)
1 parent 433828b commit 296683e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Generals/Code/Libraries/Source/WWVegas/WWMath/colmathobbobb.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
* *
2727
* Author:: Greg Hjelstrom *
2828
* *
29-
* $Modtime:: 5/04/01 8:37p $*
29+
* $Modtime:: 1/04/02 6:29p $*
3030
* *
31-
* $Revision:: 14 $*
31+
* $Revision:: 15 $*
3232
* *
3333
*---------------------------------------------------------------------------------------------*
3434
* Functions: *
@@ -593,7 +593,7 @@ static inline bool obb_separation_test
593593
if ( u1 > rsum ) {
594594
context.MaxFrac = 1.0f;
595595
return true;
596-
} else {
596+
} else if (WWMath::Fabs(u1-u0) > 0.0f) {
597597
tmp = (rsum-u0)/(u1-u0);
598598
if ( tmp > context.MaxFrac ) {
599599
context.MaxFrac = tmp;
@@ -606,7 +606,7 @@ static inline bool obb_separation_test
606606
if ( u1 < -rsum ) {
607607
context.MaxFrac = 1.0f;
608608
return true;
609-
} else {
609+
} else if (WWMath::Fabs(u1-u0) > 0.0f) {
610610
tmp = (-rsum-u0)/(u1-u0);
611611
if ( tmp > context.MaxFrac ) {
612612
context.MaxFrac = tmp;

0 commit comments

Comments
 (0)