From 8583f2e48b9640de86830849d15d2f0a02abaeb0 Mon Sep 17 00:00:00 2001
From: Ayomide Bamidele <aybamidele@gmail.com>
Date: Thu, 2 May 2019 11:47:30 +0100
Subject: [PATCH] getOrigin/getDirect now return const references. Refs: #25629

---
 .../Geometry/inc/MantidGeometry/Objects/Track.h      |  4 ++--
 .../Geometry/inc/MantidGeometry/Surfaces/Line.h      | 12 ++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/Track.h b/Framework/Geometry/inc/MantidGeometry/Objects/Track.h
index 7c37087e3a8..9ef4b51d811 100644
--- a/Framework/Geometry/inc/MantidGeometry/Objects/Track.h
+++ b/Framework/Geometry/inc/MantidGeometry/Objects/Track.h
@@ -167,9 +167,9 @@ public:
   /// Clear the current set of intersection results
   void clearIntersectionResults();
   /// Returns the starting point
-  const Kernel::V3D startPoint() const { return m_line.getOrigin(); }
+  const Kernel::V3D &startPoint() const { return m_line.getOrigin(); }
   /// Returns the direction as a unit vector
-  const Kernel::V3D direction() const { return m_line.getDirect(); }
+  const Kernel::V3D &direction() const { return m_line.getDirect(); }
   /// Returns an interator to the start of the set of links
   LType::iterator begin() { return m_links.begin(); }
   /// Returns an interator to one-past-the-end of the set of links
diff --git a/Framework/Geometry/inc/MantidGeometry/Surfaces/Line.h b/Framework/Geometry/inc/MantidGeometry/Surfaces/Line.h
index 12d6ac953ac..f033a1db4bb 100644
--- a/Framework/Geometry/inc/MantidGeometry/Surfaces/Line.h
+++ b/Framework/Geometry/inc/MantidGeometry/Surfaces/Line.h
@@ -57,10 +57,14 @@ public:
   Line *clone() const;
 
   Kernel::V3D getPoint(const double lambda) const; ///< gets the point O+lam*N
-  Kernel::V3D getOrigin() const { return Origin; } ///< returns the origin
-  Kernel::V3D getDirect() const { return Direct; } ///< returns the direction
-  double distance(const Kernel::V3D &) const;      ///< distance from line
-  int isValid(const Kernel::V3D &) const;          ///< Is the point on the line
+  const Kernel::V3D &getOrigin() const {
+    return Origin;
+  } ///< returns the origin
+  const Kernel::V3D &getDirect() const {
+    return Direct;
+  }                                           ///< returns the direction
+  double distance(const Kernel::V3D &) const; ///< distance from line
+  int isValid(const Kernel::V3D &) const;     ///< Is the point on the line
   void print() const;
 
   void rotate(const Kernel::Matrix<double> &);
-- 
GitLab