From 039ac92480a09266146fc5b0c9ec67a32a2565ad Mon Sep 17 00:00:00 2001 From: saurabhb17 Date: Wed, 26 Feb 2020 16:04:40 +0530 Subject: Added secondary files --- include/gal/opengl/glm/gtx/norm.inl | 156 ++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 include/gal/opengl/glm/gtx/norm.inl (limited to 'include/gal/opengl/glm/gtx/norm.inl') diff --git a/include/gal/opengl/glm/gtx/norm.inl b/include/gal/opengl/glm/gtx/norm.inl new file mode 100644 index 0000000..427a5a1 --- /dev/null +++ b/include/gal/opengl/glm/gtx/norm.inl @@ -0,0 +1,156 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-07-24 +// Licence : This source is under MIT License +// File : glm/gtx/norm.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + template + GLM_FUNC_QUALIFIER T length2 + ( + T const & x + ) + { + return x * x; + } + + template + GLM_FUNC_QUALIFIER T length2 + ( + detail::tvec2 const & x + ) + { + return dot(x, x); + } + + template + GLM_FUNC_QUALIFIER T length2 + ( + detail::tvec3 const & x + ) + { + return dot(x, x); + } + + template + GLM_FUNC_QUALIFIER T length2 + ( + detail::tvec4 const & x + ) + { + return dot(x, x); + } + + template + GLM_FUNC_QUALIFIER T length2 + ( + detail::tquat const & q + ) + { + return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w; + } + + template + GLM_FUNC_QUALIFIER T distance2 + ( + T const & p0, + T const & p1 + ) + { + return length2(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER T distance2 + ( + detail::tvec2 const & p0, + detail::tvec2 const & p1 + ) + { + return length2(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER T distance2 + ( + detail::tvec3 const & p0, + detail::tvec3 const & p1 + ) + { + return length2(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER T distance2 + ( + detail::tvec4 const & p0, + detail::tvec4 const & p1 + ) + { + return length2(p1 - p0); + } + + template + GLM_FUNC_QUALIFIER T l1Norm + ( + detail::tvec3 const & a, + detail::tvec3 const & b + ) + { + return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z); + } + + template + GLM_FUNC_QUALIFIER T l1Norm + ( + detail::tvec3 const & v + ) + { + return abs(v.x) + abs(v.y) + abs(v.z); + } + + template + GLM_FUNC_QUALIFIER T l2Norm + ( + detail::tvec3 const & a, + detail::tvec3 const & b + ) + { + return length(b - a); + } + + template + GLM_FUNC_QUALIFIER T l2Norm + ( + detail::tvec3 const & v + ) + { + return length(v); + } + + template + GLM_FUNC_QUALIFIER T lxNorm + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + unsigned int Depth + ) + { + return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth)); + } + + template + GLM_FUNC_QUALIFIER T lxNorm + ( + detail::tvec3 const & v, + unsigned int Depth + ) + { + return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth)); + } + +}//namespace glm -- cgit