• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/// @ref gtx_orthonormalize
2/// @file glm/gtx/orthonormalize.inl
3
4namespace glm
5{
6	template <typename T, precision P>
7	GLM_FUNC_QUALIFIER tmat3x3<T, P> orthonormalize(tmat3x3<T, P> const & m)
8	{
9		tmat3x3<T, P> r = m;
10
11		r[0] = normalize(r[0]);
12
13		T d0 = dot(r[0], r[1]);
14		r[1] -= r[0] * d0;
15		r[1] = normalize(r[1]);
16
17		T d1 = dot(r[1], r[2]);
18		d0 = dot(r[0], r[2]);
19		r[2] -= r[0] * d0 + r[1] * d1;
20		r[2] = normalize(r[2]);
21
22		return r;
23	}
24
25	template <typename T, precision P>
26	GLM_FUNC_QUALIFIER tvec3<T, P> orthonormalize(tvec3<T, P> const & x, tvec3<T, P> const & y)
27	{
28		return normalize(x - y * dot(y, x));
29	}
30}//namespace glm
31