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

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

File:
1 edited

Legend:

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

    r2346 r2348  
    937937    LOL_MEMBER_OPS(Quat, w)
    938938
    939     //Angle in degree
    940     static Quat<T> rotate(T angle, T x, T y, T z);
    941     static Quat<T> rotate(T angle, Vec3<T> const &v);
     939    /* Create a unit quaternion representing a rotation around an axis. */
     940    static Quat<T> rotate(T degrees, T x, T y, T z);
     941    static Quat<T> rotate(T degrees, Vec3<T> const &v);
    942942
    943943    /* Convert from Euler angles. The axes in fromeuler_xyx are
    944944     * x, then y', then x", ie. the axes are attached to the model.
    945945     * If you want to rotate around static axes, just reverse the order
    946      * of the arguments. */
     946     * of the arguments. Angle values are in degrees. */
    947947    static Quat<T> fromeuler_xyx(Vec3<T> const &v);
    948948    static Quat<T> fromeuler_xzx(Vec3<T> const &v);
     
    962962     * x, then y', then z", ie. the axes are attached to the model.
    963963     * If you want to apply yaw around x, pitch around y, and roll
    964      * around z, use fromeuler_xyz.
     964     * around z, use fromeuler_xyz. Angle values are in degrees.
    965965     * If you want to rotate around static axes, reverse the order in
    966966     * the function name (_zyx instead of _xyz) AND reverse the order
     
    14811481
    14821482    /* Helpers for transformation matrices */
    1483     //Angle in degree
    1484     static Mat2<T> rotate(T angle);
    1485     static inline Mat2<T> rotate(Mat2<T> mat, T angle)
    1486     {
    1487         return rotate(angle) * mat;
     1483    static Mat2<T> rotate(T degrees);
     1484    static inline Mat2<T> rotate(Mat2<T> mat, T degrees)
     1485    {
     1486        return rotate(degrees) * mat;
    14881487    }
    14891488
     
    15781577    static Mat3<T> scale(T x, T y, T z);
    15791578    static Mat3<T> scale(Vec3<T> v);
    1580     //Angle in degree
    1581     static Mat3<T> rotate(T angle, T x, T y, T z);
    1582     static Mat3<T> rotate(T angle, Vec3<T> v);
     1579    static Mat3<T> rotate(T degrees, T x, T y, T z);
     1580    static Mat3<T> rotate(T degrees, Vec3<T> v);
    15831581
    15841582    static Mat3<T> fromeuler_xyz(Vec3<T> const &v);
     
    16081606    static Mat3<T> fromeuler_zyz(T phi, T theta, T psi);
    16091607
    1610     //Angle in degree
    1611     static inline Mat3<T> rotate(Mat3<T> mat, T angle, Vec3<T> v)
    1612     {
    1613         return rotate(angle, v) * mat;
     1608    static inline Mat3<T> rotate(Mat3<T> mat, T degrees, Vec3<T> v)
     1609    {
     1610        return rotate(degrees, v) * mat;
    16141611    }
    16151612
     
    17341731    }
    17351732
    1736     //Angle in degree
    1737     static inline Mat4<T> rotate(T angle, T x, T y, T z)
    1738     {
    1739         return Mat4<T>(Mat3<T>::rotate(angle, x, y, z), (T)1);
    1740     }
    1741 
    1742     //Angle in degree
    1743     static inline Mat4<T> rotate(T angle, Vec3<T> v)
    1744     {
    1745         return Mat4<T>(Mat3<T>::rotate(angle, v), (T)1);
    1746     }
    1747 
    1748     //Angle in degree
    1749     static inline Mat4<T> rotate(Mat4<T> &mat, T angle, Vec3<T> v)
    1750     {
    1751         return rotate(angle, v) * mat;
     1733    static inline Mat4<T> rotate(T degrees, T x, T y, T z)
     1734    {
     1735        return Mat4<T>(Mat3<T>::rotate(degrees, x, y, z), (T)1);
     1736    }
     1737
     1738    static inline Mat4<T> rotate(T degrees, Vec3<T> v)
     1739    {
     1740        return Mat4<T>(Mat3<T>::rotate(degrees, v), (T)1);
     1741    }
     1742
     1743    static inline Mat4<T> rotate(Mat4<T> &mat, T degrees, Vec3<T> v)
     1744    {
     1745        return rotate(degrees, v) * mat;
    17521746    }
    17531747
Note: See TracChangeset for help on using the changeset viewer.