 |
Version: SMASH-2.0
|
|
Go to the documentation of this file.
10 #ifndef SRC_INCLUDE_SMASH_ANGLES_H_
11 #define SRC_INCLUDE_SMASH_ANGLES_H_
135 bool add_to_theta(
const double delta,
const bool reverse);
163 double theta()
const;
170 using std::invalid_argument::invalid_argument;
197 if (newphi < 0 || newphi >=
twopi) {
209 throw InvalidTheta(
"Wrong value for costheta (must be in [-1,1]): " +
225 if (delta < -M_PI || delta > M_PI) {
227 std::to_string(delta));
229 double theta_plus_delta = delta +
theta();
233 if (theta_plus_delta > M_PI) {
239 }
else if (theta_plus_delta < 0) {
250 double plusminus_one = reverse ? -1.0 : +1.0;
251 bool this_reverse =
add_to_theta(plusminus_one * delta);
256 return this_reverse ^ reverse;
276 #endif // SRC_INCLUDE_SMASH_ANGLES_H_
void set_phi(const double phi)
Sets the azimuthal angle.
std::basic_ostream< CharT, Traits > & field(std::basic_ostream< CharT, Traits > &s)
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
void distribute_isotropically()
Populate the object with a new direction.
void set_theta(const double theta)
Set the polar angle.
constexpr double really_small
Numerical error tolerance.
Angles()
Default constructor.
Angles(double ph, double cost)
void set_costheta(const double cos)
Set the polar angle from its cosine.
double phi_
Azimuthal angle .
ThreeVector threevec() const
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
double costheta_
Cosine of polar angle .
bool add_to_theta(const double delta)
Advance polar angle.