# Changeset 2348Tweet

Ignore:
Timestamp:
Feb 4, 2013, 10:24:20 PM (6 years ago)
Message:

math: use "degrees" as the variable name for rotations for clarity.

Location:
trunk/src
Files:
2 edited

Unmodified
Removed
• ## trunk/src/lol/math/vector.h

 r2346 LOL_MEMBER_OPS(Quat, w) //Angle in degree static Quat rotate(T angle, T x, T y, T z); static Quat rotate(T angle, Vec3 const &v); /* Create a unit quaternion representing a rotation around an axis. */ static Quat rotate(T degrees, T x, T y, T z); static Quat rotate(T degrees, Vec3 const &v); /* Convert from Euler angles. The axes in fromeuler_xyx are * x, then y', then x", ie. the axes are attached to the model. * If you want to rotate around static axes, just reverse the order * of the arguments. */ * of the arguments. Angle values are in degrees. */ static Quat fromeuler_xyx(Vec3 const &v); static Quat fromeuler_xzx(Vec3 const &v); * x, then y', then z", ie. the axes are attached to the model. * If you want to apply yaw around x, pitch around y, and roll * around z, use fromeuler_xyz. * around z, use fromeuler_xyz. Angle values are in degrees. * If you want to rotate around static axes, reverse the order in * the function name (_zyx instead of _xyz) AND reverse the order /* Helpers for transformation matrices */ //Angle in degree static Mat2 rotate(T angle); static inline Mat2 rotate(Mat2 mat, T angle) { return rotate(angle) * mat; static Mat2 rotate(T degrees); static inline Mat2 rotate(Mat2 mat, T degrees) { return rotate(degrees) * mat; } static Mat3 scale(T x, T y, T z); static Mat3 scale(Vec3 v); //Angle in degree static Mat3 rotate(T angle, T x, T y, T z); static Mat3 rotate(T angle, Vec3 v); static Mat3 rotate(T degrees, T x, T y, T z); static Mat3 rotate(T degrees, Vec3 v); static Mat3 fromeuler_xyz(Vec3 const &v); static Mat3 fromeuler_zyz(T phi, T theta, T psi); //Angle in degree static inline Mat3 rotate(Mat3 mat, T angle, Vec3 v) { return rotate(angle, v) * mat; static inline Mat3 rotate(Mat3 mat, T degrees, Vec3 v) { return rotate(degrees, v) * mat; } } //Angle in degree static inline Mat4 rotate(T angle, T x, T y, T z) { return Mat4(Mat3::rotate(angle, x, y, z), (T)1); } //Angle in degree static inline Mat4 rotate(T angle, Vec3 v) { return Mat4(Mat3::rotate(angle, v), (T)1); } //Angle in degree static inline Mat4 rotate(Mat4 &mat, T angle, Vec3 v) { return rotate(angle, v) * mat; static inline Mat4 rotate(T degrees, T x, T y, T z) { return Mat4(Mat3::rotate(degrees, x, y, z), (T)1); } static inline Mat4 rotate(T degrees, Vec3 v) { return Mat4(Mat3::rotate(degrees, v), (T)1); } static inline Mat4 rotate(Mat4 &mat, T degrees, Vec3 v) { return rotate(degrees, v) * mat; }
• ## trunk/src/math/vector.cpp

 r2317 } template<> mat2 mat2::rotate(float angle) { angle *= (M_PI / 180.0f); float st = sin(angle); float ct = cos(angle); template<> mat2 mat2::rotate(float degrees) { degrees *= (M_PI / 180.0f); float st = sin(degrees); float ct = cos(degrees); mat2 ret; } template<> mat3 mat3::rotate(float angle, float x, float y, float z) { angle *= (M_PI / 180.0f); float st = sin(angle); float ct = cos(angle); template<> mat3 mat3::rotate(float degrees, float x, float y, float z) { degrees *= (M_PI / 180.0f); float st = sin(degrees); float ct = cos(degrees); float len = std::sqrt(x * x + y * y + z * z); } template<> mat3 mat3::rotate(float angle, vec3 v) { return rotate(angle, v.x, v.y, v.z); template<> mat3 mat3::rotate(float degrees, vec3 v) { return rotate(degrees, v.x, v.y, v.z); } } template<> quat quat::rotate(float angle, vec3 const &v) { angle *= (M_PI / 360.0f); vec3 tmp = normalize(v) * sin(angle); return quat(cos(angle), tmp.x, tmp.y, tmp.z); } template<> quat quat::rotate(float angle, float x, float y, float z) { return quat::rotate(angle, vec3(x, y, z)); template<> quat quat::rotate(float degrees, vec3 const &v) { degrees *= (M_PI / 360.0f); vec3 tmp = normalize(v) * sin(degrees); return quat(cos(degrees), tmp.x, tmp.y, tmp.z); } template<> quat quat::rotate(float degrees, float x, float y, float z) { return quat::rotate(degrees, vec3(x, y, z)); }
Note: See TracChangeset for help on using the changeset viewer.