MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
particle.h
1#ifndef MCXRAYTRANSPORT_PARTICLE_H
2#define MCXRAYTRANSPORT_PARTICLE_H
3
4#include <Eigen/Core>
5#include <Eigen/Dense>
6
7namespace ParticleHelpers{
8
17 Eigen::Vector3d rotateDirection(const Eigen::Vector3d& vector, const double& theta, const double& phi);
18
19
28 Eigen::Vector3d getPerpendicularVector(const Eigen::Vector3d& vector);
29}
30
36class Particle {
37public:
38 Particle() = default;
46 Particle(Eigen::Vector3d& position, Eigen::Vector3d& direction, double energy);
47
53 Eigen::Vector3d getPosition() const {return position_;}
54
60 Eigen::Vector3d getDirection() const {return direction_;}
61
67 double getEnergy() const {return energy_;}
68
74 void move(const double& distance) {
75 position_ += distance * direction_;
76 }
77
83 void setDirection(const Eigen::Vector3d& newDirection) {
84 direction_ = newDirection;
85 }
86
95 void rotate(const double& theta, const double& phi) {
96 direction_ = ParticleHelpers::rotateDirection(direction_, theta, phi);
97 }
98
104 void setEnergy(const double& newEnergy) {
105 energy_ = newEnergy;
106 }
107
113 bool isTerminated() const {
114 return terminated_;
115 }
116
120 void terminate() {
121 terminated_ = true;
122 }
123
129 bool isPrimary() const {
130 return isPrimary_;
131 }
132
138 void setPrimary(bool primary_status) {
139 isPrimary_ = primary_status;
140 }
141private:
142 Eigen::Vector3d position_;
143 Eigen::Vector3d direction_;
144 double energy_{};
145 bool terminated_ = false;
146 bool isPrimary_ = true;
147};
148
149#endif //MCXRAYTRANSPORT_PARTICLE_H
Class which represents a particle.
Definition particle.h:36
Particle(Eigen::Vector3d &position, Eigen::Vector3d &direction, double energy)
Constructor for the Particle class.
Eigen::Vector3d getDirection() const
Returns the direction of the particle.
Definition particle.h:60
void setDirection(const Eigen::Vector3d &newDirection)
Sets the direction of the particle.
Definition particle.h:83
bool isPrimary() const
Returns whether or not the particle is primary.
Definition particle.h:129
void setEnergy(const double &newEnergy)
Sets the energy of the particle.
Definition particle.h:104
bool isTerminated() const
Returns whether or not the particle has terminated.
Definition particle.h:113
void move(const double &distance)
Moves the particle by the given distance in the direction of the particle.
Definition particle.h:74
void rotate(const double &theta, const double &phi)
Rotates the particle by the given angles with respect to the initial direction of the particle,...
Definition particle.h:95
Eigen::Vector3d getPosition() const
Returns the position of the particle.
Definition particle.h:53
void terminate()
Terminates the particle.
Definition particle.h:120
void setPrimary(bool primary_status)
Sets whether or not the particle is primary.
Definition particle.h:138
double getEnergy() const
Returns the energy of the particle.
Definition particle.h:67