const BBox operator +(const BBox &a, const BBox &b) { Vect pmin; pmin.setX(min(a.pmin.getX(), b.pmin.getX())); pmin.setY(min(a.pmin.getY(), b.pmin.getY())); pmin.setZ(min(a.pmin.getZ(), b.pmin.getZ())); Vect pmax; pmax.setX(max(a.pmax.getX(), b.pmax.getX())); pmax.setY(max(a.pmax.getY(), b.pmax.getY())); pmax.setZ(max(a.pmax.getZ(), b.pmax.getZ())); BBox box; box.setMin(pmin); box.setMax(pmax); return box; }
void StressTest( void ) { #if IMPLICIT_CONVERSIONS volatile int I_ValueX(2); volatile int I_ValueY(3); volatile int I_ValueZ(4); volatile char C_ValueX(7); volatile char C_ValueY(8); volatile char C_ValueZ(9); volatile double D_ValueX( 11 ); volatile double D_ValueY( 12 ); volatile double D_ValueZ( 13 ); #else volatile float I_ValueX(2); volatile float I_ValueY(3); volatile float I_ValueZ(4); volatile float C_ValueX(7); volatile float C_ValueY(8); volatile float C_ValueZ(9); volatile float D_ValueX( 11 ); volatile float D_ValueY( 12 ); volatile float D_ValueZ( 13 ); #endif // Disable warning message (simulating bad users) #pragma warning( disable : 4244 ) Vect A; A.setX( I_ValueX ); A.setY( I_ValueY ); A.setZ( I_ValueZ ); Vect B( D_ValueX, I_ValueY, D_ValueZ ); Vect C; C = A + B; Vect D( C ); D.setX( D_ValueZ ); C.setZ( I_ValueX ); Vect E = A + B; A.set( I_ValueX, D_ValueY, C_ValueX ); B = A+ B; C = B + E; E.setZ(I_ValueX ); Vect F; F.setX(C_ValueX); Vect G( F.getX(), A.getY(), B.getZ() ); Vect H( C.getZ(), C_ValueZ, F.getX() ); }