10 #ifndef SRC_INCLUDE_ANGLES_H_ 11 #define SRC_INCLUDE_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_ANGLES_H_ The ThreeVector class represents a physical three-vector with the components .
constexpr double really_small
Numerical error tolerance.
Collection of useful constants that are known at compile time.
void set_theta(const double theta)
Set the polar angle.
double costheta_
Cosine of polar angle .
std::basic_ostream< CharT, Traits > & field(std::basic_ostream< CharT, Traits > &s)
Stream modifier to align the next object to a specific width w.
ThreeVector threevec() const
Angles()
Default constructor.
Thrown for invalid values for theta.
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.
Angles provides a common interface for generating directions: i.e., two angles that should be interpr...
void distribute_isotropically()
Populate the object with a new direction.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
double phi_
Azimuthal angle .
void set_costheta(const double cos)
Set the polar angle from its cosine.