Home | History | Annotate | Download | only in gtx
      1 ///////////////////////////////////////////////////////////////////////////////////////////////////
      2 // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
      3 ///////////////////////////////////////////////////////////////////////////////////////////////////
      4 // Created : 2006-04-21
      5 // Updated : 2006-12-06
      6 // Licence : This source is under MIT License
      7 // File    : glm/gtx/inertia.inl
      8 ///////////////////////////////////////////////////////////////////////////////////////////////////
      9 
     10 namespace glm
     11 {
     12 /*
     13 	template <typename T>
     14 	GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> boxInertia3
     15 	(
     16 		T const & Mass, 
     17 		detail::tvec3<T, P> const & Scale
     18 	)
     19 	{
     20 		detail::tmat3x3<T, P> Result(T(1));
     21 		Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
     22 		Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12);
     23 		Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12);
     24 		return Result;
     25 	}
     26 
     27 	template <typename T>
     28 	GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> boxInertia4
     29 	(
     30 		T const & Mass, 
     31 		detail::tvec3<T, P> const & Scale
     32 	)
     33 	{
     34 		detail::tmat4x4<T, P> Result(T(1));
     35 		Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
     36 		Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12);
     37 		Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12);
     38 		return Result;
     39 	}
     40 
     41 	template <typename T>
     42 	GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> diskInertia3
     43 	(
     44 		T const & Mass, 
     45 		T const & Radius
     46 	)
     47 	{
     48 		T a = Mass * Radius * Radius / T(2);
     49 		detail::tmat3x3<T, P> Result(a);
     50 		Result[2][2] *= static_cast<T>(2);
     51 		return Result;
     52 	}
     53 
     54 	template <typename T>
     55 	GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> diskInertia4
     56 	(
     57 		T const & Mass, 
     58 		T const & Radius
     59 	)
     60 	{
     61 		T a = Mass * Radius * Radius / T(2);
     62 		detail::tmat4x4<T, P> Result(a);
     63 		Result[2][2] *= static_cast<T>(2);
     64 		Result[3][3] = static_cast<T>(1);
     65 		return Result;
     66 	}
     67 
     68 	template <typename T>
     69 	GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> ballInertia3
     70 	(
     71 		T const & Mass, 
     72 		T const & Radius
     73 	)
     74 	{
     75 		T a = static_cast<T>(2) * Mass * Radius * Radius / T(5);
     76 		return detail::tmat3x3<T, P>(a);
     77 	}
     78 
     79 	template <typename T>
     80 	GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> ballInertia4
     81 	(
     82 		T const & Mass, 
     83 		T const & Radius
     84 	)
     85 	{
     86 		T a = static_cast<T>(2) * Mass * Radius * Radius / T(5);
     87 		detail::tmat4x4<T, P> Result(a);
     88 		Result[3][3] = static_cast<T>(1);
     89 		return Result;
     90 	}
     91 
     92 	template <typename T>
     93 	GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> sphereInertia3
     94 	(
     95 		T const & Mass, 
     96 		T const & Radius
     97 	)
     98 	{
     99 		T a = static_cast<T>(2) * Mass * Radius * Radius / T(3);
    100 		return detail::tmat3x3<T, P>(a);
    101 	}
    102 
    103 	template <typename T>
    104 	GLM_FUNC_QUALIFIER detail::tmat4x4<T, P> sphereInertia4
    105 	(
    106 		T const & Mass, 
    107 		T const & Radius
    108 	)
    109 	{
    110 		T a = static_cast<T>(2) * Mass * Radius * Radius / T(3);
    111 		detail::tmat4x4<T, P> Result(a);
    112 		Result[3][3] = static_cast<T>(1);
    113 		return Result;
    114 	}
    115  */
    116 }//namespace glm
    117