|  |  |  | @ -30,81 +30,44 @@ | 
			
		
	
		
			
				
					|  |  |  |  | /// @author Christophe Riccio | 
			
		
	
		
			
				
					|  |  |  |  | /////////////////////////////////////////////////////////////////////////////////// | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | namespace glm | 
			
		
	
		
			
				
					|  |  |  |  | namespace glm{ | 
			
		
	
		
			
				
					|  |  |  |  | namespace detail | 
			
		
	
		
			
				
					|  |  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T length2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		T const & x | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	template <template <typename, precision> class vecType, typename T, precision P, bool Aligned> | 
			
		
	
		
			
				
					|  |  |  |  | 	struct compute_length2 | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		return x * x; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T length2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec2<T, P> const & x | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 		GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & v) | 
			
		
	
		
			
				
					|  |  |  |  | 		{ | 
			
		
	
		
			
				
					|  |  |  |  | 		return dot(x, x); | 
			
		
	
		
			
				
					|  |  |  |  | 			return dot(v, v); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	}; | 
			
		
	
		
			
				
					|  |  |  |  | }//namespace detail | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T length2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec3<T, P> const & x | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename genType> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER genType length2(genType x) | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		return dot(x, x); | 
			
		
	
		
			
				
					|  |  |  |  | 		GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length2' accepts only floating-point inputs"); | 
			
		
	
		
			
				
					|  |  |  |  | 		return x * x; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T length2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec4<T, P> const & x | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P, template <typename, precision> class vecType> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T length2(vecType<T, P> const & v) | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		return dot(x, x); | 
			
		
	
		
			
				
					|  |  |  |  | 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length2' accepts only floating-point inputs"); | 
			
		
	
		
			
				
					|  |  |  |  | 		return detail::compute_length2<vecType, T, P, detail::is_aligned<P>::value>::call(v); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T distance2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		T const & p0, | 
			
		
	
		
			
				
					|  |  |  |  | 		T const & p1 | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T distance2(T p0, T p1) | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs"); | 
			
		
	
		
			
				
					|  |  |  |  | 		return length2(p1 - p0); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T distance2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec2<T, P> const & p0, | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec2<T, P> const & p1 | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		return length2(p1 - p0); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T distance2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec3<T, P> const & p0, | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec3<T, P> const & p1 | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		return length2(p1 - p0); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T distance2 | 
			
		
	
		
			
				
					|  |  |  |  | 	( | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec4<T, P> const & p0, | 
			
		
	
		
			
				
					|  |  |  |  | 		tvec4<T, P> const & p1 | 
			
		
	
		
			
				
					|  |  |  |  | 	) | 
			
		
	
		
			
				
					|  |  |  |  | 	template <typename T, precision P, template <typename, precision> class vecType> | 
			
		
	
		
			
				
					|  |  |  |  | 	GLM_FUNC_QUALIFIER T distance2(vecType<T, P> const & p0, vecType<T, P> const & p1) | 
			
		
	
		
			
				
					|  |  |  |  | 	{ | 
			
		
	
		
			
				
					|  |  |  |  | 		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance2' accepts only floating-point inputs"); | 
			
		
	
		
			
				
					|  |  |  |  | 		return length2(p1 - p0); | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |