Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 16, 2008, 3:46:25 AM (16 years ago)
Author:
landauf
Message:

added comments to all my classes in util

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/util/Math.h

    r1781 r1791  
    2626 *
    2727 */
     28
     29/**
     30    @file Math.h
     31    @brief Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the orxonox namespace.
     32*/
    2833
    2934#ifndef _Util_Math_H__
     
    6873
    6974//Get around Windows hackery
    70 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 
     75#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
    7176#  ifdef max
    7277#    undef max
     
    7782#endif
    7883
     84/**
     85    @brief Returns the sign of the given value.
     86    @param x The value
     87    @return 1 if the value is positive or zero, -1 if the value is negative
     88*/
    7989template <typename T>
    8090inline T sgn(T x)
     
    8393}
    8494
     95/**
     96    @brief Returns the smaller of two values.
     97*/
    8598template <typename T>
    8699inline T min(T a, T b)
     
    89102}
    90103
     104/**
     105    @brief Returns the greater of two values.
     106*/
    91107template <typename T>
    92108inline T max(T a, T b)
     
    95111}
    96112
     113/**
     114    @brief Keeps a value between a lower and an upper limit.
     115    @param x The value
     116    @param min The lower limit
     117    @param max The upper limit
     118*/
    97119template <typename T>
    98120inline T clamp(T x, T min, T max)
     
    107129}
    108130
     131/**
     132    @brief Returns the square value (x^2).
     133*/
    109134template <typename T>
    110135inline T square(T x)
     
    113138}
    114139
     140/**
     141    @brief Returns the cube value (x^3).
     142*/
    115143template <typename T>
    116144inline T cube(T x)
     
    119147}
    120148
     149/**
     150    @brief Rounds the value down.
     151*/
    121152template <typename T>
    122153inline int floor(T x)
     
    125156}
    126157
     158/**
     159    @brief Rounds the value up.
     160*/
    127161template <typename T>
    128162inline int ceil(T x)
     
    132166}
    133167
     168/**
     169    @brief Rounds the value.
     170*/
    134171template <typename T>
    135172inline int round(T x)
     
    138175}
    139176
     177/**
     178    @brief The modulo operation, enhanced to work properly with negative values.
     179    @param x The value
     180    @param max The operand
     181*/
    140182template <typename T>
    141183inline int mod(T x, int max)
     
    147189}
    148190
     191/**
     192    @brief Interpolates between two values for a time between 0 and 1.
     193    @param time The time is a value between 0 and 1 - the function returns start if time is 0 and end if time is 1 and interpolates if time is between 0 and 1.
     194    @param start The value at time = 0
     195    @param end The value at time = 1
     196    @return The interpolation at a given time
     197*/
    149198template <typename T>
    150199T interpolate(float time, const T& start, const T& end)
     
    153202}
    154203
     204/**
     205    @brief Interpolates smoothly between two values for a time between 0 and 1. The function starts slowly, increases faster and stops slowly again.
     206    @param time The time is a value between 0 and 1 - the function returns start if time is 0 and end if time is 1 and interpolates if time is between 0 and 1.
     207    @param start The value at time = 0
     208    @param end The value at time = 1
     209    @return The smoothed interpolation at a given time
     210*/
    155211template <typename T>
    156212T interpolateSmooth(float time, const T& start, const T& end)
     
    159215}
    160216
     217/**
     218    @brief Returns a random number between 0 and 1.
     219*/
    161220inline _UtilExport float rnd()
    162221{
     
    164223}
    165224
     225/**
     226    @brief Returns a random number between 0 and max.
     227    @param max The maximum
     228*/
    166229inline _UtilExport float rnd(float max)
    167230{
     
    169232}
    170233
     234/**
     235    @brief Returns a random number between min and max.
     236    @param min The minimum
     237    @param max The maximum
     238*/
    171239inline _UtilExport float rnd(float min, float max)
    172240{
Note: See TracChangeset for help on using the changeset viewer.