/////////////////////////////////////////////////////////////////////////////////////////////////// // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2013-10-25 // Updated : 2013-10-25 // Licence : This source is under MIT licence // File : test/gtx/fast_trigonometry.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include namespace fastCos { int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for(float i=begin; i(time_fast)); std::printf("cos Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } }//namespace fastCos namespace fastSin { int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("sin Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } }//namespace fastSin namespace fastTan { int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("tan Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } }//namespace fastTan namespace fastAcos { int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("acos Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } }//namespace fastAcos namespace fastAsin { int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("asin Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } }//namespace fastAsin namespace fastAtan { int perf() { const float begin = -glm::pi(); const float end = glm::pi(); float result = 0.f; const std::clock_t timestamp1 = std::clock(); for (float i = begin; i(time_fast)); std::printf("atan Time %d clocks\n", static_cast(time_default)); return time_fast < time_default ? 0 : 1; } }//namespace fastAtan int main() { int Error(0); # ifdef GLM_TEST_ENABLE_PERF Error += ::fastCos::perf(); Error += ::fastSin::perf(); Error += ::fastTan::perf(); Error += ::fastAcos::perf(); Error += ::fastAsin::perf(); Error += ::fastAtan::perf(); # endif return Error; }