Wayverb
hit_rate.h
1 #pragma once
2 
3 #include "raytracer/simulation_parameters.h"
4 
5 #include <cmath>
6 
7 namespace wayverb {
8 namespace raytracer {
9 
10 constexpr auto mean_hits_per_interval(const simulation_parameters& params,
11  double speed_of_sound,
12  double room_volume) {
13  return (params.rays * M_PI * params.receiver_radius *
14  params.receiver_radius * speed_of_sound) /
15  (room_volume * params.histogram_sample_rate);
16 }
17 
18 constexpr auto required_rays(double hits_per_interval,
19  double receiver_radius,
20  double speed_of_sound,
21  double histogram_sample_rate,
22  double room_volume) {
23  return (hits_per_interval * room_volume * histogram_sample_rate) /
24  (M_PI * receiver_radius * receiver_radius * speed_of_sound);
25 }
26 
27 constexpr auto make_simulation_parameters(
28  double hits_per_interval,
29  double receiver_radius,
30  double speed_of_sound,
31  double histogram_sample_rate,
32  double room_volume,
33  size_t maximum_image_source_order) {
34  return simulation_parameters{
35  static_cast<size_t>(required_rays(hits_per_interval,
36  receiver_radius,
37  speed_of_sound,
38  histogram_sample_rate,
39  room_volume)),
40  maximum_image_source_order,
41  receiver_radius,
42  histogram_sample_rate};
43 }
44 
45 } // namespace raytracer
46 } // namespace wayverb
Definition: pressure.h:22
Definition: capsule_base.h:9