mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Moving definition of reflect method.
This commit is contained in:
parent
ebca9a489d
commit
d99b7aab51
1 changed files with 11 additions and 6 deletions
|
|
@ -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<double>& 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;}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue