9 #if !defined(M_PI) && !defined(SWIG) 10 #define M_PI 3.14159265358979323846264338327950288 17 double random(
double min,
double max);
23 return (angle - 90) *
M_PI / 180;
29 return angle * 180 /
M_PI + 90;
36 return angle *
M_PI / 180;
42 return angle * 180 /
M_PI;
54 double offset_y(
double angle,
double radius);
57 double angle(
double from_x,
double from_y,
double to_x,
double to_y,
double def = 0);
60 double angle_diff(
double angle1,
double angle2);
76 if (value < min)
return min;
77 if (value > max)
return max;
84 int wrap(
int value,
int min,
int max);
88 float wrap(
float value,
float min,
float max);
92 double wrap(
double value,
double min,
double max);
95 inline double distance_sqr(
double x1,
double y1,
double x2,
double y2)
101 double distance(
double x1,
double y1,
double x2,
double y2);
109 return a * (1.0 - weight) + b * weight;
double distance(double x1, double y1, double x2, double y2)
Returns the distance between two points.
T 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...
double distance_sqr(double x1, double y1, double x2, double y2)
Returns the square of the distance between two points.
T square(T value)
Returns value * value.
double degrees_to_radians(double angle)
Translates between degrees (used by Gosu) and radians, i.e.
double 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)...
double 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-c...
double 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.
double offset_x(double angle, double radius)
Returns the horizontal distance between the origin and the point to which you would get if you moved ...
double normalize_angle(double angle)
Normalizes an angle to fit into the range [0; 360[.
int wrap(int value, int min, int max)
Returns (value-min) % (max-min) + min, where % always has a positive result for max > min...
Color interpolate(Color a, Color b, double weight=0.5)
Interpolates linearly between two colors, with a given weight towards the second color.
double random(double min, double max)
Returns a real value between min (inclusive) and max (exclusive).
double 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)...
double radians_to_degrees(double angle)
Translates between degrees (used by Gosu) and radians, i.e.
double offset_y(double angle, double radius)
Returns the vertical distance between the origin and the point to which you would get if you moved ra...