10 #ifndef SRC_INCLUDE_SMASH_ANGLES_H_
11 #define SRC_INCLUDE_SMASH_ANGLES_H_
142 bool add_to_theta(
const double delta,
const bool reverse);
172 double theta()
const;
179 using std::invalid_argument::invalid_argument;
208 if (newphi < 0 || newphi >=
twopi) {
216 if (newpsi < 0 || newpsi >=
twopi) {
228 throw InvalidTheta(
"Wrong value for costheta (must be in [-1,1]): " +
244 if (delta < -M_PI || delta > M_PI) {
246 std::to_string(delta));
248 double theta_plus_delta = delta +
theta();
252 if (theta_plus_delta > M_PI) {
258 }
else if (theta_plus_delta < 0) {
269 double plusminus_one = reverse ? -1.0 : +1.0;
270 bool this_reverse =
add_to_theta(plusminus_one * delta);
275 return this_reverse ^ reverse;
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
ThreeVector threevec() const
void distribute_isotropically()
Populate the object with a new direction.
void set_costheta(const double cos)
Set the polar angle from its cosine.
bool add_to_theta(const double delta)
Advance polar angle.
Angles(double ph, double cost)
void set_phi(const double phi)
Sets the azimuthal angle.
void set_theta(const double theta)
Set the polar angle.
double phi_
Azimuthal angle .
double costheta_
Cosine of polar angle .
Angles()
Default constructor.
void set_psi(const double psi)
Sets the euler angle psi.
The ThreeVector class represents a physical three-vector with the components .
Collection of useful constants that are known at compile time.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
std::basic_ostream< CharT, Traits > & field(std::basic_ostream< CharT, Traits > &s)
Stream modifier to align the next object to a specific width w.
constexpr double really_small
Numerical error tolerance.
Thrown for invalid values for theta.