Gosu
Namespaces | Macros | Functions
Math.hpp File Reference

Contains simple math functionality. More...

Go to the source code of this file.

Namespaces

 Gosu
 The library's main namespace.
 

Macros

#define M_PI   3.14159265358979323846264338327950288
 

Functions

long Gosu::trunc (double value)
 Truncates the fractional part of a real value. More...
 
long Gosu::round (double value)
 Rounds a real value towards the next integer. More...
 
double Gosu::random (double min, double max)
 Returns a real value between min (inclusive) and max (exclusive). More...
 
double Gosu::gosu_to_radians (double angle)
 Translates between Gosu's angle system (where 0 is at the top) and radians (where 0 is at the right). More...
 
double Gosu::radians_to_gosu (double angle)
 Translates between Gosu's angle system (where 0 is at the top) and radians (where 0 is at the right). More...
 
double Gosu::degrees_to_radians (double angle)
 Translates between degrees (used by Gosu) and radians, i.e. More...
 
double Gosu::radians_to_degrees (double angle)
 Translates between degrees (used by Gosu) and radians, i.e. More...
 
double Gosu::offset_x (double angle, double radius)
 Returns the horizontal distance between the origin and the point to which you would get if you moved radius pixels in the direction specified by angle. More...
 
double Gosu::offset_y (double angle, double radius)
 Returns the vertical distance between the origin and the point to which you would get if you moved radius pixels in the direction specified by angle. More...
 
double Gosu::angle (double from_x, double from_y, double to_x, double to_y, double def=0)
 Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards. More...
 
double Gosu::angle_diff (double angle1, double angle2)
 Returns the smallest angle that can be added to angle1 to get to angle2 (can be negative if counter-clockwise movement is shorter). More...
 
double Gosu::normalize_angle (double angle)
 Normalizes an angle to fit into the range [0; 360[. More...
 
template<typename T >
Gosu::square (T value)
 Returns value * value. More...
 
template<typename T >
Gosu::clamp (T value, T min, T max)
 Returns min if value is smaller than min, max if value is larger than max and value otherwise. More...
 
int Gosu::wrap (int value, int min, int max)
 Returns (value-min) % (max-min) + min, where % always has a positive result for max > min. More...
 
float Gosu::wrap (float value, float min, float max)
 Returns (value-min) % (max-min) + min, where % always has a positive result for max > min. More...
 
double Gosu::wrap (double value, double min, double max)
 Returns (value-min) % (max-min) + min, where % always has a positive result for max > min. More...
 
double Gosu::distance_sqr (double x1, double y1, double x2, double y2)
 Returns the square of the distance between two points. More...
 
double Gosu::distance (double x1, double y1, double x2, double y2)
 Returns the distance between two points. More...
 
template<typename T >
Gosu::interpolate (T a, T b, double weight=0.5)
 Interpolates a value between a and b, weight being the bias towards the second value. More...
 

Detailed Description

Contains simple math functionality.

Definition in file Math.hpp.

Macro Definition Documentation

◆ M_PI

#define M_PI   3.14159265358979323846264338327950288