| 1 | /// @ref ext_scalar_reciprocal |
| 2 | |
| 3 | #include "../trigonometric.hpp" |
| 4 | #include <limits> |
| 5 | |
| 6 | namespace glm |
| 7 | { |
| 8 | // sec |
| 9 | template<typename genType> |
| 10 | GLM_FUNC_QUALIFIER genType sec(genType angle) |
| 11 | { |
| 12 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'sec' only accept floating-point values"); |
| 13 | return genType(1) / glm::cos(angle); |
| 14 | } |
| 15 | |
| 16 | // csc |
| 17 | template<typename genType> |
| 18 | GLM_FUNC_QUALIFIER genType csc(genType angle) |
| 19 | { |
| 20 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'csc' only accept floating-point values"); |
| 21 | return genType(1) / glm::sin(angle); |
| 22 | } |
| 23 | |
| 24 | // cot |
| 25 | template<typename genType> |
| 26 | GLM_FUNC_QUALIFIER genType cot(genType angle) |
| 27 | { |
| 28 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'cot' only accept floating-point values"); |
| 29 | |
| 30 | genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0); |
| 31 | return glm::tan(pi_over_2 - angle); |
| 32 | } |
| 33 | |
| 34 | // asec |
| 35 | template<typename genType> |
| 36 | GLM_FUNC_QUALIFIER genType asec(genType x) |
| 37 | { |
| 38 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'asec' only accept floating-point values"); |
| 39 | return acos(genType(1) / x); |
| 40 | } |
| 41 | |
| 42 | // acsc |
| 43 | template<typename genType> |
| 44 | GLM_FUNC_QUALIFIER genType acsc(genType x) |
| 45 | { |
| 46 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'acsc' only accept floating-point values"); |
| 47 | return asin(genType(1) / x); |
| 48 | } |
| 49 | |
| 50 | // acot |
| 51 | template<typename genType> |
| 52 | GLM_FUNC_QUALIFIER genType acot(genType x) |
| 53 | { |
| 54 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'acot' only accept floating-point values"); |
| 55 | |
| 56 | genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0); |
| 57 | return pi_over_2 - atan(x); |
| 58 | } |
| 59 | |
| 60 | // sech |
| 61 | template<typename genType> |
| 62 | GLM_FUNC_QUALIFIER genType sech(genType angle) |
| 63 | { |
| 64 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'sech' only accept floating-point values"); |
| 65 | return genType(1) / glm::cosh(angle); |
| 66 | } |
| 67 | |
| 68 | // csch |
| 69 | template<typename genType> |
| 70 | GLM_FUNC_QUALIFIER genType csch(genType angle) |
| 71 | { |
| 72 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'csch' only accept floating-point values"); |
| 73 | return genType(1) / glm::sinh(angle); |
| 74 | } |
| 75 | |
| 76 | // coth |
| 77 | template<typename genType> |
| 78 | GLM_FUNC_QUALIFIER genType coth(genType angle) |
| 79 | { |
| 80 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'coth' only accept floating-point values"); |
| 81 | return glm::cosh(angle) / glm::sinh(angle); |
| 82 | } |
| 83 | |
| 84 | // asech |
| 85 | template<typename genType> |
| 86 | GLM_FUNC_QUALIFIER genType asech(genType x) |
| 87 | { |
| 88 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'asech' only accept floating-point values"); |
| 89 | return acosh(genType(1) / x); |
| 90 | } |
| 91 | |
| 92 | // acsch |
| 93 | template<typename genType> |
| 94 | GLM_FUNC_QUALIFIER genType acsch(genType x) |
| 95 | { |
| 96 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'acsch' only accept floating-point values"); |
| 97 | return asinh(genType(1) / x); |
| 98 | } |
| 99 | |
| 100 | // acoth |
| 101 | template<typename genType> |
| 102 | GLM_FUNC_QUALIFIER genType acoth(genType x) |
| 103 | { |
| 104 | static_assert(std::numeric_limits<genType>::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'acoth' only accept floating-point values"); |
| 105 | return atanh(genType(1) / x); |
| 106 | } |
| 107 | }//namespace glm |