mirror of
https://github.com/g-truc/glm.git
synced 2024-11-27 02:34:35 +00:00
Refacted GTC_angle
This commit is contained in:
parent
929f140b1e
commit
28c6bba18c
@ -33,53 +33,8 @@
|
|||||||
#include "../glm.hpp"
|
#include "../glm.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template <typename T>
|
|
||||||
class angle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef T value_type;
|
|
||||||
|
|
||||||
angle(value_type const & x) :
|
*/
|
||||||
data(x)
|
|
||||||
{}
|
|
||||||
|
|
||||||
private:
|
|
||||||
value_type data;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef angle<glm::half> angle16;
|
|
||||||
typedef angle<float> angle32;
|
|
||||||
typedef angle<double> angle64;
|
|
||||||
|
|
||||||
GLM_FUNC_DECL angle<float> operator "" _rad_f(long double const radians)
|
|
||||||
{
|
|
||||||
return static_cast<float>(radians);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_DECL angle<double> operator "" _rad(long double const radians)
|
|
||||||
{
|
|
||||||
return static_cast<double>(radians);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_DECL angle<long double> operator "" _rad_l(long double const radians)
|
|
||||||
{
|
|
||||||
return radians;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_DECL angle<float> operator "" _deg_f(long double const degrees)
|
|
||||||
{
|
|
||||||
return static_cast<float>(degrees) * static_cast<float>(0.01745329251994329576923690768489L);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_DECL angle<double> operator "" _deg(long double const degrees)
|
|
||||||
{
|
|
||||||
return static_cast<double>(degrees) * static_cast<double>(0.01745329251994329576923690768489L);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_DECL angle<long double> operator "" _deg_l(long double const degrees)
|
|
||||||
{
|
|
||||||
return degrees * 0.01745329251994329576923690768489L;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -20,34 +20,75 @@
|
|||||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
/// THE SOFTWARE.
|
/// THE SOFTWARE.
|
||||||
///
|
///
|
||||||
/// @ref core
|
/// @ref gtc_angle
|
||||||
/// @file glm/core/_angles.hpp
|
/// @file glm/gtc/angle.hpp
|
||||||
/// @date 2013-05-06 / 2013-05-06
|
/// @date 2013-05-07 / 2012-05-07
|
||||||
/// @author Christophe Riccio
|
/// @author Christophe Riccio
|
||||||
|
///
|
||||||
|
/// @see core (dependence)
|
||||||
|
/// @see gtc_angle (dependence)
|
||||||
|
///
|
||||||
|
/// @defgroup gtc_angle GLM_GTC_angle
|
||||||
|
/// @ingroup gtc
|
||||||
|
///
|
||||||
|
/// @brief Handling angles in both radians and degrees.
|
||||||
|
///
|
||||||
|
/// <glm/gtc/angle.hpp> need to be included to use these features.
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef glm_core_angles
|
#ifndef GLM_GTC_angle
|
||||||
#define glm_core_angles
|
#define GLM_GTC_angle GLM_VERSION
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class deg
|
class angle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
|
||||||
|
angle(value_type const & x) :
|
||||||
|
data(x)
|
||||||
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T data;
|
value_type data;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
typedef angle<glm::half> angle16;
|
||||||
T operator ""_deg(T const & degrees)
|
typedef angle<float> angle32;
|
||||||
|
typedef angle<double> angle64;
|
||||||
|
|
||||||
|
GLM_FUNC_DECL angle<float> operator "" _rad_f(long double const radians)
|
||||||
{
|
{
|
||||||
// returns radians
|
return static_cast<float>(radians);
|
||||||
return degrees * T(0.01745329251994329576923690768489);
|
}
|
||||||
|
|
||||||
|
GLM_FUNC_DECL angle<double> operator "" _rad(long double const radians)
|
||||||
|
{
|
||||||
|
return static_cast<double>(radians);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLM_FUNC_DECL angle<long double> operator "" _rad_l(long double const radians)
|
||||||
|
{
|
||||||
|
return radians;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLM_FUNC_DECL angle<float> operator "" _deg_f(long double const degrees)
|
||||||
|
{
|
||||||
|
return static_cast<float>(degrees) * static_cast<float>(0.01745329251994329576923690768489L);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLM_FUNC_DECL angle<double> operator "" _deg(long double const degrees)
|
||||||
|
{
|
||||||
|
return static_cast<double>(degrees) * static_cast<double>(0.01745329251994329576923690768489L);
|
||||||
|
}
|
||||||
|
|
||||||
|
GLM_FUNC_DECL angle<long double> operator "" _deg_l(long double const degrees)
|
||||||
|
{
|
||||||
|
return degrees * 0.01745329251994329576923690768489L;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
|
||||||
#endif//glm_core_angles
|
#endif//GLM_GTC_angle
|
||||||
|
Loading…
Reference in New Issue
Block a user