mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
maths: Add Distance function
This commit is contained in:
parent
9dd7960584
commit
ac2f94f242
2 changed files with 5 additions and 0 deletions
|
@ -54,3 +54,7 @@ SYMBOL_EXPORT int Sign(double val) {
|
||||||
SYMBOL_EXPORT double Fract(double val) {
|
SYMBOL_EXPORT double Fract(double val) {
|
||||||
return val - floor(val);
|
return val - floor(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYMBOL_EXPORT double Distance(double x1, double y1, double x2, double y2) {
|
||||||
|
return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
|
||||||
|
}
|
||||||
|
|
|
@ -30,5 +30,6 @@ double Clamp(double left, double right, double val);
|
||||||
double Lerp(double left, double right, double pos);
|
double Lerp(double left, double right, double pos);
|
||||||
int Sign(double val);
|
int Sign(double val);
|
||||||
double Fract(double val);
|
double Fract(double val);
|
||||||
|
double Distance(double x1, double y1, double x2, double y2);
|
||||||
|
|
||||||
#endif /* LIBSUPERDERPY_MATHS_H */
|
#endif /* LIBSUPERDERPY_MATHS_H */
|
||||||
|
|
Loading…
Reference in a new issue