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.
|
| double | max3 (double v1, double v2, double v3) |
| | Returns the maximum of 3 values.
|
| double | min3 (double v1, double v2, double v3) |
| | Returns the minimum of 3 values.
|
| void | arrayShuffle (void **array) |
| | Randomly sorts an array (array.h) of pointers in place with the Fisher-Yates shuffle.
|
| 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.
|
| double | ease_SineInOut (double x) |
| | Simple symmetric sine-based easing.
|
| double | ease_QuadraticInOut (double x) |
| | Simple symmetric quadratic easing.
|
| double | ease_CubicInOut (double x) |
| | Simple symmetric cubic easing.
|
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 68 of file nmath.c.
◆ ease_CubicInOut()
| double ease_CubicInOut |
( |
double | x | ) |
|
Simple symmetric cubic easing.
Definition at line 122 of file nmath.c.
◆ ease_QuadraticInOut()
| double ease_QuadraticInOut |
( |
double | x | ) |
|
Simple symmetric quadratic easing.
Definition at line 112 of file nmath.c.
◆ ease_SineInOut()
| double ease_SineInOut |
( |
double | x | ) |
|
Simple symmetric sine-based easing.
Definition at line 104 of file nmath.c.
◆ max3()
| double max3 |
( |
double | v1, |
|
|
double | v2, |
|
|
double | v3 ) |
Returns the maximum of 3 values.
Definition at line 46 of file nmath.c.
◆ min3()
| double min3 |
( |
double | v1, |
|
|
double | v2, |
|
|
double | v3 ) |
Returns the minimum of 3 values.
Definition at line 56 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 (or complex).
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 91 of file nmath.c.