commit be88d89dd938aaa2e56afd7f18577ec0a0aad77d
parent b8624878c2def4826afd1afd90c2a0d49908bdd3
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 17 Mar 2020 10:22:02 +0100
Add the htsky_spectral_band_sample_quadrature function
Diffstat:
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/htsky.c b/src/htsky.c
@@ -966,6 +966,25 @@ htsky_sample_sw_spectral_data_CIE_1931_Z
ispectral_band, iquadrature_pt);
}
+size_t
+htsky_spectral_band_sample_quadrature
+ (const struct htsky* sky,
+ const double r,
+ const size_t iband)
+{
+ struct htgop_spectral_interval band;
+ size_t iquad;
+ ASSERT(sky->bands_range[0] <= iband || iband <= sky->bands_range[1]);
+
+ if(sky->is_long_wave) {
+ HTGOP(get_lw_spectral_interval(sky->htgop, iband, &band));
+ } else {
+ HTGOP(get_sw_spectral_interval(sky->htgop, iband, &band));
+ }
+ HTGOP(spectral_interval_sample_quadrature(&band, r, &iquad));
+ return iquad;
+}
+
/*******************************************************************************
* Local functions
******************************************************************************/
diff --git a/src/htsky.h b/src/htsky.h
@@ -233,6 +233,13 @@ htsky_sample_sw_spectral_data_CIE_1931_Z
size_t* ispectral_band,
size_t* iquadrature_pt);
+/* Returned the sampled quadrature point */
+HTSKY_API size_t
+htsky_spectral_band_sample_quadrature
+ (const struct htsky* sky,
+ const double r, /* Random number in [0, 1[ */
+ const size_t ispectral_band);
+
HTSKY_API res_T
htsky_dump_cloud_vtk
(const struct htsky* sky,