/*****************************************************************************
 * $LastChangedDate: 2011-04-10 17:44:55 -0400 (Sun, 10 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Math functions (debug).
 * REMINDERS: Consider using MATH_EXCEPTION() instead of ASSERT().
 *//*
 * LEGAL:   COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef MATH_FUNCS_DEBUG_HH
#define MATH_FUNCS_DEBUG_HH 1

namespace math {

////////////////////////////////////////////////////////////////////////////////
///////////////////////////////  D E B U G  ////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

// Condition is tested the same as ASSERT() but throws C++ exception.
// Clients of math now depend on C++ exception.
#define MATH_EXCEPTION( COND, TEXT ) {{ if ( UX( not (COND) ) ) throw Exception( TEXT ); }}

// Check axis.
#define ASSERT_AXIS2( AXIS2 ) ASSERT( uint(AXIS2) < 2u )  /// (2D) true if axis is XX,YY
#define ASSERT_AXIS3( AXIS3 ) ASSERT( uint(AXIS3) < 3u )  /// (3D) true if axis is XX,YY,ZZ

} // namespace math

#endif // MATH_FUNCS_DEBUG_HH
