1 /***************************************************************************** 2 * $LastChangedDate: 2011-04-10 17:44:55 -0400 (Sun, 10 Apr 2011) $ 3 * @file 4 * @author Jim E. Brooks http://www.palomino3d.org 5 * @brief Math functions (debug). 6 * REMINDERS: Consider using MATH_EXCEPTION() instead of ASSERT(). 7 *//* 8 * LEGAL: COPYRIGHT (C) 2004 JIM E. BROOKS 9 * THIS SOURCE CODE IS RELEASED UNDER THE TERMS 10 * OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2). 11 *****************************************************************************/ 12 13 #ifndef MATH_FUNCS_DEBUG_HH 14 #define MATH_FUNCS_DEBUG_HH 1 15 16 namespace math { 17 18 //////////////////////////////////////////////////////////////////////////////// 19 /////////////////////////////// D E B U G //////////////////////////////////// 20 //////////////////////////////////////////////////////////////////////////////// 21 22 // Condition is tested the same as ASSERT() but throws C++ exception. 23 // Clients of math now depend on C++ exception. 24 #define MATH_EXCEPTION( COND, TEXT ) {{ if ( UX( not (COND) ) ) throw Exception( TEXT ); }} 25 26 // Check axis. 27 #define ASSERT_AXIS2( AXIS2 ) ASSERT( uint(AXIS2) < 2u ) /// (2D) true if axis is XX,YY 28 #define ASSERT_AXIS3( AXIS3 ) ASSERT( uint(AXIS3) < 3u ) /// (3D) true if axis is XX,YY,ZZ 29 30 } // namespace math 31 32 #endif // MATH_FUNCS_DEBUG_HH 33