mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Add norm method on Position
This commit is contained in:
parent
19de269ae6
commit
b7feb47971
1 changed files with 4 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef OPENMC_POSITION_H
|
||||
#define OPENMC_POSITION_H
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
namespace openmc {
|
||||
|
|
@ -46,6 +47,9 @@ struct Position {
|
|||
inline double dot(Position other) {
|
||||
return x*other.x + y*other.y + z*other.z;
|
||||
}
|
||||
inline double norm() {
|
||||
return std::sqrt(x*x + y*y + z*z);
|
||||
}
|
||||
|
||||
// Data members
|
||||
double x = 0.;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue