13 const arma::vec3 surface_normal) {
15 arma::vec3 new_direction =
17 2.0 * arma::dot(initial_direction, surface_normal) * surface_normal;
18 arma::vec3 normalized_direction = arma::normalise(new_direction);
19 return Ordinate(std::atan2(normalized_direction(1), normalized_direction(0)),
20 std::acos(normalized_direction(2)));
24 if (
polar > M_PI)
throw std::invalid_argument(
"Polar angle must be <= pi.");
25 if (
polar < 0)
throw std::invalid_argument(
"Polar angle must be >= 0.");
27 throw std::invalid_argument(
"Azimuthal angle must be <= pi.");
29 throw std::invalid_argument(
"Azimuthal angle must be >= 0.");
Ordinate(const double azimuth, const double polar)
Construct a new Ordinate object.
const double polar_
Polar angle in radians.
const double azimuth_
Azimuthal angle in radians.
double polar() const
Getter for polar angle.
double x() const
Evaluate the x-direction cosine.
double azimuth() const
Getter for azimuthal angle.
double y() const
Evaluate the y-direction cosine.
arma::vec3 CartesianUnitVector() const
Returns the Ordinate as a Cartesian unit vector.
void CheckInput(const double azimuth, const double polar)
Check that input angles are within expected bounds.
static Ordinate Reflect(const Ordinate &ordinate, const arma::vec3 surface_normal)
Construct a new Ordinate object in the reflected direction given a starting direction and surface nor...
double z() const
Evaluate the z-direction cosine.