Program: 70964
Project: 70964
Buggy source:
/** 
 * Determines if two bounding boxes with half widths <code>hw1</code> and <code>hw2</code> are disjoint. The first box is assumed to be axis-aligned and centered at the origin, while the coordinate frame of the second box has position and orientation given by <code>p21</code> and <code>R21</code>, respectively. <p> For details on this algorithm, see pg 338 of Game Physics by David Eberly, or "OBBTree: A Hierarchichal Structure for Rapid Interference Detection", Gottschalk Lin & Manocha
 */
public static final boolean isDisjoint(Vector3d hw1,Vector3d hw2,RotationMatrix3d R21,Vector3d p21){
  double t;
  double p_x=p21.x;
  if ((t=p_x) < 0)   t=-t;
  double m00=R21.m00;
  double m01=R21.m01;
  double m02=R21.m02;
  double abs00=(m00 >= 0 ? m00 : -m00);
  double abs01=(m01 >= 0 ? m01 : -m01);
  double abs02=(m02 >= 0 ? m02 : -m02);
  if (t > (hw1.x + hw2.x * abs00 + hw2.y * abs01 + hw2.z * abs02))   return true;
  double m10=R21.m10;
  double m20=R21.m20;
  double p_y=p21.y;
  double p_z=p21.z;
  if ((t=p_x * m00 + p_y * m10 + p_z * m20) < 0)   t=-t;
  double abs10=(m10 >= 0 ? m10 : -m10);
  double abs20=(m20 >= 0 ? m20 : -m20);
  if (t > (hw2.x + hw1.x * abs00 + hw1.y * abs10 + hw1.z * abs20))   return true;
  if ((t=p_y) < 0)   t=-t;
  double m11=R21.m11;
  double m12=R21.m12;
  double abs11=(m11 >= 0 ? m11 : -m11);
  double abs12=(m12 >= 0 ? m12 : -m12);
  if (t > (hw1.y + hw2.x * abs10 + hw2.y * abs11 + hw2.z * abs12))   return true;
  if ((t=p_z) < 0)   t=-t;
  double m21=R21.m21;
  double m22=R21.m22;
  double abs21=(m21 >= 0 ? m21 : -m21);
  double abs22=(m22 >= 0 ? m22 : -m22);
  if (t > (hw1.z + hw2.x * abs20 + hw2.y * abs21 + hw2.z * abs22))   return true;
  if ((t=p_x * m01 + p_y * m11 + p_z * m21) < 0)   t=-t;
  if (t > (hw2.y + hw1.x * abs01 + hw1.y * abs11 + hw1.z * abs21))   return true;
  if ((t=p_x * m02 + p_y * m12 + p_z * m22) < 0)   t=-t;
  if (t > (hw2.z + hw1.x * abs02 + hw1.y * abs12 + hw1.z * abs22))   return true;
  if ((t=p_z * m10 - p_y * m20) < 0)   t=-t;
  if (t > (hw1.y * abs20 + hw1.z * abs10 + hw2.y * abs02 + hw2.z * abs01))   return true;
  if ((t=p_z * m11 - p_y * m21) < 0)   t=-t;
  if (t > (hw1.y * abs21 + hw1.z * abs11 + hw2.x * abs02 + hw2.z * abs00))   return true;
  if ((t=p_z * m12 - p_y * m22) < 0)   t=-t;
  if (t > (hw1.y * abs22 + hw1.z * abs12 + hw2.x * abs01 + hw2.y * abs00))   return true;
  if ((t=p_x * m20 - p_z * m00) < 0)   t=-t;
  if (t > (hw1.x * abs20 + hw1.z * abs00 + hw2.y * abs12 + hw2.z * abs11))   return true;
  if ((t=p_x * m21 - p_z * m01) < 0)   t=-t;
  if (t > (hw1.x * abs21 + hw1.z * abs01 + hw2.x * abs12 + hw2.z * abs10))   return true;
  if ((t=p_x * m22 - p_z * m02) < 0)   t=-t;
  if (t > (hw1.x * abs22 + hw1.z * abs02 + hw2.x * abs11 + hw2.y * abs10))   return true;
  if ((t=p_y * m00 - p_x * m10) < 0)   t=-t;
  if (t > (hw1.x * abs10 + hw1.y * abs00 + hw2.y * abs22 + hw2.z * abs21))   return true;
  if ((t=p_y * m01 - p_x * m11) < 0)   t=-t;
  if (t > (hw1.x * abs11 + hw1.y * abs01 + hw2.x * abs22 + hw2.z * abs20))   return true;
  if ((t=p_y * m02 - p_x * m12) < 0)   t=-t;
  if (t > (hw1.x * abs12 + hw1.y * abs02 + hw2.x * abs21 + hw2.y * abs20))   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Determines if two bounding boxes with half widths <code>hw1</code> and <code>hw2</code> are disjoint. The first box is assumed to be axis-aligned and centered at the origin, while the coordinate frame of the second box has position and orientation given by <code>p21</code> and <code>R21</code>, respectively. <p> For details on this algorithm, see pg 338 of Game Physics by David Eberly, or "OBBTree: A Hierarchichal Structure for Rapid Interference Detection", Gottschalk Lin &amp; Manocha
 */
public static final boolean isDisjoint(Vector3d hw1,Vector3d hw2,RotationMatrix3d R21,Vector3d p21){
  double t;
  double p_x=p21.x;
  if ((t=p_x) < 0)   t=-t;
  double m00=R21.m00;
  double m01=R21.m01;
  double m02=R21.m02;
  double abs00=(m00 >= 0 ? m00 : -m00);
  double abs01=(m01 >= 0 ? m01 : -m01);
  double abs02=(m02 >= 0 ? m02 : -m02);
  if (t > (hw1.x + hw2.x * abs00 + hw2.y * abs01 + hw2.z * abs02))   return true;
  double m10=R21.m10;
  double m20=R21.m20;
  double p_y=p21.y;
  double p_z=p21.z;
  if ((t=p_x * m00 + p_y * m10 + p_z * m20) < 0)   t=-t;
  double abs10=(m10 >= 0 ? m10 : -m10);
  double abs20=(m20 >= 0 ? m20 : -m20);
  if (t > (hw2.x + hw1.x * abs00 + hw1.y * abs10 + hw1.z * abs20))   return true;
  if ((t=p_y) < 0)   t=-t;
  double m11=R21.m11;
  double m12=R21.m12;
  double abs11=(m11 >= 0 ? m11 : -m11);
  double abs12=(m12 >= 0 ? m12 : -m12);
  if (t > (hw1.y + hw2.x * abs10 + hw2.y * abs11 + hw2.z * abs12))   return true;
  if ((t=p_z) < 0)   t=-t;
  double m21=R21.m21;
  double m22=R21.m22;
  double abs21=(m21 >= 0 ? m21 : -m21);
  double abs22=(m22 >= 0 ? m22 : -m22);
  if (t > (hw1.z + hw2.x * abs20 + hw2.y * abs21 + hw2.z * abs22))   return true;
  if ((t=p_x * m01 + p_y * m11 + p_z * m21) < 0)   t=-t;
  if (t > (hw2.y + hw1.x * abs01 + hw1.y * abs11 + hw1.z * abs21))   return true;
  if ((t=p_x * m02 + p_y * m12 + p_z * m22) < 0)   t=-t;
  if (t > (hw2.z + hw1.x * abs02 + hw1.y * abs12 + hw1.z * abs22))   return true;
  if ((t=p_z * m10 - p_y * m20) < 0)   t=-t;
  if (t > (hw1.y * abs20 + hw1.z * abs10 + hw2.y * abs02 + hw2.z * abs01))   return true;
  if ((t=p_z * m11 - p_y * m21) < 0)   t=-t;
  if (t > (hw1.y * abs21 + hw1.z * abs11 + hw2.x * abs02 + hw2.z * abs00))   return true;
  if ((t=p_z * m12 - p_y * m22) < 0)   t=-t;
  if (t > (hw1.y * abs22 + hw1.z * abs12 + hw2.x * abs01 + hw2.y * abs00))   return true;
  if ((t=p_x * m20 - p_z * m00) < 0)   t=-t;
  if (t > (hw1.x * abs20 + hw1.z * abs00 + hw2.y * abs12 + hw2.z * abs11))   return true;
  if ((t=p_x * m21 - p_z * m01) < 0)   t=-t;
  if (t > (hw1.x * abs21 + hw1.z * abs01 + hw2.x * abs12 + hw2.z * abs10))   return true;
  if ((t=p_x * m22 - p_z * m02) < 0)   t=-t;
  if (t > (hw1.x * abs22 + hw1.z * abs02 + hw2.x * abs11 + hw2.y * abs10))   return true;
  if ((t=p_y * m00 - p_x * m10) < 0)   t=-t;
  if (t > (hw1.x * abs10 + hw1.y * abs00 + hw2.y * abs22 + hw2.z * abs21))   return true;
  if ((t=p_y * m01 - p_x * m11) < 0)   t=-t;
  if (t > (hw1.x * abs11 + hw1.y * abs01 + hw2.x * abs22 + hw2.z * abs20))   return true;
  if ((t=p_y * m02 - p_x * m12) < 0)   t=-t;
  if (t > (hw1.x * abs12 + hw1.y * abs02 + hw2.x * abs21 + hw2.y * abs20))   return true;
  return false;
}