diff --git a/src/maths.c b/src/maths.c index ed5964e..4430608 100644 --- a/src/maths.c +++ b/src/maths.c @@ -54,3 +54,7 @@ SYMBOL_EXPORT int Sign(double val) { SYMBOL_EXPORT double Fract(double 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)); +} diff --git a/src/maths.h b/src/maths.h index 8c428dc..3ef7553 100644 --- a/src/maths.h +++ b/src/maths.h @@ -30,5 +30,6 @@ double Clamp(double left, double right, double val); double Lerp(double left, double right, double pos); int Sign(double val); double Fract(double val); +double Distance(double x1, double y1, double x2, double y2); #endif /* LIBSUPERDERPY_MATHS_H */