Some math routines for naev.
More...
#include "nmath.h"
#include "array.h"
#include "log.h"
#include "rng.h"
Go to the source code of this file.
|
| int | nmath_solve2Eq (double results[2], double a, double b, double c) |
| | Solves the equation: a * x^2 + b * x + c = 0. More...
|
| |
| double | max3 (double v1, double v2, double v3) |
| | Returns the maximum of 3 values. More...
|
| |
| double | min3 (double v1, double v2, double v3) |
| | Returns the minimum of 3 values. More...
|
| |
| void | arrayShuffle (void **array) |
| | Randomly sorts an array (array.h) of pointers in place with the Fisher-Yates shuffle. More...
|
| |
| int | rectOverlap (double x, double y, double w, double h, double x2, double y2, double w2, double h2) |
| | Checks whether two rectangles overlap at any point. More...
|
| |
| double | ease_SineInOut (double x) |
| | Simple symmetric sine-based easing. More...
|
| |
| double | ease_QuadraticInOut (double x) |
| | Simple symmetric quadratic easing. More...
|
| |
| double | ease_CubicInOut (double x) |
| | Simple symmetric cubic easing. More...
|
| |
Some math routines for naev.
Definition in file nmath.c.
◆ arrayShuffle()
| void arrayShuffle |
( |
void ** |
array | ) |
|
Randomly sorts an array (array.h) of pointers in place with the Fisher-Yates shuffle.
Definition at line 70 of file nmath.c.
◆ ease_CubicInOut()
| double ease_CubicInOut |
( |
double |
x | ) |
|
Simple symmetric cubic easing.
Definition at line 124 of file nmath.c.
◆ ease_QuadraticInOut()
| double ease_QuadraticInOut |
( |
double |
x | ) |
|
Simple symmetric quadratic easing.
Definition at line 114 of file nmath.c.
◆ ease_SineInOut()
| double ease_SineInOut |
( |
double |
x | ) |
|
Simple symmetric sine-based easing.
Definition at line 106 of file nmath.c.
◆ max3()
| double max3 |
( |
double |
v1, |
|
|
double |
v2, |
|
|
double |
v3 |
|
) |
| |
Returns the maximum of 3 values.
Definition at line 48 of file nmath.c.
◆ min3()
| double min3 |
( |
double |
v1, |
|
|
double |
v2, |
|
|
double |
v3 |
|
) |
| |
Returns the minimum of 3 values.
Definition at line 58 of file nmath.c.
◆ nmath_solve2Eq()
| int nmath_solve2Eq |
( |
double |
results[2], |
|
|
double |
a, |
|
|
double |
b, |
|
|
double |
c |
|
) |
| |
Solves the equation: a * x^2 + b * x + c = 0.
- Parameters
-
| results | Stores both results. |
| a | Quadratic parameter. |
| b | Linear parameter. |
| c | Offset coefficient. |
- Returns
- 0 on success, -1 on error.
Definition at line 30 of file nmath.c.
◆ rectOverlap()
| int rectOverlap |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
w, |
|
|
double |
h, |
|
|
double |
x2, |
|
|
double |
y2, |
|
|
double |
w2, |
|
|
double |
h2 |
|
) |
| |
Checks whether two rectangles overlap at any point.
- Parameters
-
| x | X coordinate of first rectangle |
| y | Y coordinate of first rectangle |
| w | Width of first rectangle |
| h | Height of first rectangle |
| x2 | X coordinate of second rectangle |
| y2 | Y coordinate of second rectangle |
| w2 | Width of second rectangle |
| h2 | Height of second rectangle |
- Returns
- 1 if the rectangles overlap, 0 otherwise.
Definition at line 93 of file nmath.c.