diff options
-rw-r--r-- | redist/linmath.c | 5 | ||||
-rw-r--r-- | redist/linmath.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/redist/linmath.c b/redist/linmath.c index c57410f..01ae2b0 100644 --- a/redist/linmath.c +++ b/redist/linmath.c @@ -63,6 +63,11 @@ void copy3d(FLT *out, const FLT *in) { } FLT magnitude3d(const FLT *a) { return FLT_SQRT(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]); } +FLT dist3d(const FLT *a, const FLT *b) { + LinmathPoint3d tmp; + sub3d(tmp, a, b); + return magnitude3d(tmp); +} FLT anglebetween3d(FLT *a, FLT *b) { FLT an[3]; diff --git a/redist/linmath.h b/redist/linmath.h index 71fd9b0..76e1322 100644 --- a/redist/linmath.h +++ b/redist/linmath.h @@ -6,7 +6,7 @@ #ifdef __cplusplus extern "C" { #endif - + // Yes, I know it's kind of arbitrary. #define DEFAULT_EPSILON 0.001 @@ -82,7 +82,7 @@ int compare3d(const FLT *a, const FLT *b, FLT epsilon); void copy3d(FLT *out, const FLT *in); FLT magnitude3d(const FLT *a); - +FLT dist3d(const FLT *a, const FLT *b); FLT anglebetween3d(FLT *a, FLT *b); void rotatearoundaxis(FLT *outvec3, FLT *invec3, FLT *axis, FLT angle); |