From 05c61a3dbd3efd20cc2725da11f1314e63b7bd91 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Fri, 6 Sep 2024 13:16:49 +0200 Subject: [PATCH] Add distance between --- Spherical.cpp | 7 +++++++ Spherical.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Spherical.cpp b/Spherical.cpp index b4d6d07..7f6c3ca 100644 --- a/Spherical.cpp +++ b/Spherical.cpp @@ -208,6 +208,13 @@ SphericalOf SphericalOf::operator/=(float f) { const float epsilon = 1E-05f; +template +float SphericalOf::DistanceBetween(const SphericalOf& v1, + const SphericalOf& v2) { + SphericalOf difference = v1 - v2; + return difference.distance; +} + template AngleOf SphericalOf::AngleBetween(const SphericalOf& v1, const SphericalOf& v2) { diff --git a/Spherical.h b/Spherical.h index fa4b79f..2c4a12b 100644 --- a/Spherical.h +++ b/Spherical.h @@ -103,6 +103,8 @@ class SphericalOf { /// The distance between the two vectors // static float Distance(const Spherical &s1, const Spherical &s2); + static float DistanceBetween(const SphericalOf& v1, + const SphericalOf& v2); static AngleOf AngleBetween(const SphericalOf& v1, const SphericalOf& v2);