From f8a503217845c407f80dc49cccd4043689904106 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Thu, 11 Feb 2010 21:09:46 +0000 Subject: [PATCH] implement gradient of distance function [[Imported from SVN: r5543]] --- src/realtuple.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/realtuple.hh b/src/realtuple.hh index 071c1372..c16fe23a 100644 --- a/src/realtuple.hh +++ b/src/realtuple.hh @@ -41,6 +41,12 @@ public: return (a.data_ - b.data_).two_norm(); } + /** \brief Compute the gradient of the distance function keeping the first argument fixed + */ + static EmbeddedTangentVector derivativeOfDistanceWRTSecondArgument(const RealTuple& a, const RealTuple& b) { + EmbeddedTangentVector gradient = a.data_ - b.data_; + return -gradient/distance(a,b); + } /** \brief Write LocalKey object to output stream */ friend std::ostream& operator<< (std::ostream& s, const RealTuple& realTuple) -- GitLab