From d99b7aab51d16dd6548c0e033a5de03b5beb2266 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Mon, 24 Aug 2020 10:09:24 -0500 Subject: [PATCH] Moving definition of reflect method. --- include/openmc/position.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/openmc/position.h b/include/openmc/position.h index 643447ac2a..3046f61636 100644 --- a/include/openmc/position.h +++ b/include/openmc/position.h @@ -63,12 +63,10 @@ struct Position { return std::sqrt(x*x + y*y + z*z); } - inline Position reflect(Position n) { - const double projection = n.dot(*this); - const double magnitude = n.dot(n); - n *= (2.0 * projection / magnitude); - return *this - n; - } + //! Reflect a direction across a normal vector + //! \param[in] other Vector to reflect across + //! \result Reflected vector + Position reflect(Position n) const; //! Rotate the position based on a rotation matrix Position rotate(const std::vector& rotation) const; @@ -96,6 +94,13 @@ inline Position operator/(Position a, Position b) { return a /= b; } inline Position operator/(Position a, double b) { return a /= b; } inline Position operator/(double a, Position b) { return b /= a; } +inline Position Position::reflect(Position n) const { + const double projection = n.dot(*this); + const double magnitude = n.dot(n); + n *= (2.0 * projection / magnitude); + return *this - n; +} + inline bool operator==(Position a, Position b) {return a.x == b.x && a.y == b.y && a.z == b.z;}