Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 02f25da2506abd97bc869a73cc2323f4a8eb1b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* 	functions.h
	This file is part of the Osirion project
*/

#ifndef __INCLUDED_FUNCTIONS_H__
#define __INCLUDED_FUNCTIONS_H__

#include <cstdlib>
#include <cmath>

/// return the smallest of two float values
float min(float a, float b);

/// return the smallest of two integers
int min(int a, int b);

/// return the largest of two float values
float max(float a, float b);

/// return the largest of two integers
int max(int a, int b);

/// returns a random float
/*! The value returned will be in the interval [0-max]
 * @param max the maximum value returned
**/
float randomf(const float max = 1);

/// returns a random integer
/*! The value returned will be in the interval [0-(max-1)]
 * @param max the maximum value returned
**/
unsigned int randomi(const unsigned int max);

/// return the sign of a float value
float sgnf(float value);

/// return an angle in the ]-180,180] range
float degreesf(float angle);

#endif // __INCLUDED_FUNCTIONS_H__