protot/3rdparty/RuntimeCompiledCpp/Common/Math.inl

46 lines
1.6 KiB
C++

//
// Copyright (c) 2010-2011 Matthew Jack and Doug Binks
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
#pragma once
#ifndef AUMATH_DEFINED
#define AUMATH_DEFINED
#define _USE_MATH_DEFINES
#include <math.h>
/* Adds some helpful macros and exposes the non-standard constants available in math.h (may not be portable):
* M_E - e
* M_LOG2E - log2(e)
* M_LOG10E - log10(e)
* M_LN2 - ln(2)
* M_LN10 - ln(10)
* M_PI - pi
* M_PI_2 - pi/2
* M_PI_4 - pi/4
* M_1_PI - 1/pi
* M_2_PI - 2/pi
* M_2_SQRTPI - 2/sqrt(pi)
* M_SQRT2 - sqrt(2)
* M_SQRT1_2 - 1/sqrt(2)
*/
#define DEG2RAD(deg) ((deg)*((PI)/(180.0)))
#define RAD2DEG(rad) ((rad)*((180.0)/(PI)))
#define LERP(a, b, t) ((a) + (t) * ((b) - (a)))
#endif // AUMATH_DEFINED