From 6f67371bb1b46579ae837d0e0c61ac1b291be743 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 13 Jan 2018 07:51:33 +0500 Subject: Directory renamed --- external/include/glm/gtx/polar_coordinates.inl | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 external/include/glm/gtx/polar_coordinates.inl (limited to 'external/include/glm/gtx/polar_coordinates.inl') diff --git a/external/include/glm/gtx/polar_coordinates.inl b/external/include/glm/gtx/polar_coordinates.inl new file mode 100644 index 0000000..afc9d2b --- /dev/null +++ b/external/include/glm/gtx/polar_coordinates.inl @@ -0,0 +1,37 @@ +/// @ref gtx_polar_coordinates +/// @file glm/gtx/polar_coordinates.inl + +namespace glm +{ + template + GLM_FUNC_QUALIFIER tvec3 polar + ( + tvec3 const & euclidean + ) + { + T const Length(length(euclidean)); + tvec3 const tmp(euclidean / Length); + T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); + + return tvec3( + asin(tmp.y), // latitude + atan(tmp.x, tmp.z), // longitude + xz_dist); // xz distance + } + + template + GLM_FUNC_QUALIFIER tvec3 euclidean + ( + tvec2 const & polar + ) + { + T const latitude(polar.x); + T const longitude(polar.y); + + return tvec3( + cos(latitude) * sin(longitude), + sin(latitude), + cos(latitude) * cos(longitude)); + } + +}//namespace glm -- cgit v1.2.3