OpenGL Mathematics (GLM)
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
 
 
 

64 lines
2.2 KiB

///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2006-01-04
// Updated : 2008-10-07
// Licence : This source is under MIT License
// File : glm/gtx/fast_square_root.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////
// Dependency:
// - GLM core
///////////////////////////////////////////////////////////////////////////////////////////////////
// Note:
// - Sqrt optimisation based on Newton's method,
// www.gamedev.net/community/forums/topic.asp?topic id=139956
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef glm_gtx_fast_square_root
#define glm_gtx_fast_square_root
// Dependency:
#include "../glm.hpp"
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_GTX_fast_square_root extension included")
#endif
namespace glm{
namespace gtx
{
/// @addtogroup gtx_fast_square_root
/// @{
//! Faster than the common sqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension.
template <typename genType>
genType fastSqrt(genType const & x);
//! Faster than the common inversesqrt function but less accurate.
//! From GLM_GTX_fast_square_root extension.
template <typename genType>
genType fastInverseSqrt(genType const & x);
//! Faster than the common length function but less accurate.
//! From GLM_GTX_fast_square_root extension.
template <typename genType>
typename genType::value_type fastLength(genType const & x);
//! Faster than the common distance function but less accurate.
//! From GLM_GTX_fast_square_root extension.
template <typename genType>
typename genType::value_type fastDistance(genType const & x, genType const & y);
//! Faster than the common normalize function but less accurate.
//! From GLM_GTX_fast_square_root extension.
template <typename genType>
genType fastNormalize(genType const & x);
/// @}
}// namespace gtx
}// namespace glm
#include "fast_square_root.inl"
#endif//glm_gtx_fast_square_root