20 #ifndef ANTKEEPER_PHYSICS_GAS_ATMOSPHERE_HPP
21 #define ANTKEEPER_PHYSICS_GAS_ATMOSPHERE_HPP
32 namespace atmosphere {
47 constexpr T k = T(2) * math::pi<T> * math::pi<T>;
48 const T ior2m1 = ior * ior - T(1);
49 const T num = k * ior2m1 * ior2m1;
50 const T den = T(3) * density * density;
72 return math::four_pi<T> * (density / (wavelength2 * wavelength2)) *
polarization;
150 for (std::size_t i = 1; i < n; ++i)
158 return sum / T(2) * h;
191 for (std::size_t i = 1; i < n; ++i)
202 return sum / T(2) * h;
223 return d0 * std::exp(-z / sh);
constexpr vector< T, N > max(const vector< T, N > &x, const vector< T, N > &y)
Returns a vector containing the maximum elements of two vectors.
T length(const quaternion< T > &q)
Calculates the length of a quaternion.
constexpr T sum(const vector< T, N > &x) noexcept
Calculates the sum of all elements in a vector.
constexpr T gas
Molar gas constant (R), in joule per kelvin per mole.
T exponential(T d0, T z, T sh)
Calculates the density of exponentially-distributed atmospheric particles at a given elevation.
T triangular(T d0, T z, T a, T b, T c)
Calculates the density of triangularly-distributed atmospheric particles at a given elevation.
T extinction(T scattering, T albedo)
Calculates an extinction coefficient.
T absorption(T scattering, T albedo)
Calculates an absorption coefficient.
T scattering(T density, T polarization, T wavelength)
Calculates a wavelength-dependent scattering coefficient.
T polarization(T ior, T density)
Calculates a particle polarizability factor.
T optical_depth_exp(const math::vec3< T > &a, const math::vec3< T > &b, T r, T sh, std::size_t n)
Approximates the optical depth of exponentially-distributed atmospheric particles between two points ...
T optical_depth_tri(const math::vec3< T > &p0, const math::vec3< T > &p1, T r, T a, T b, T c, std::size_t n)
Approximates the optical depth of triangularly-distributed atmospheric particles between two points u...
T wavelength(T t, T lambda, T c=constants::speed_of_light< T >)
Wavelength variant of Planck's law.