commit 59385134eaf6cdb5d442e1c4a4af43ea40a866d1
parent 7707bd2a06e48cd32b6001bda4890715bd1cc956
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 2 Jun 2020 10:14:39 +0200
Add the htsky_get_raw_spectral_bounds function
Return the spectral boundaries of the raw sky data, in nanometers. The
returned range is not clamped against the user provided spectral range.
Diffstat:
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/htsky.c b/src/htsky.c
@@ -973,6 +973,29 @@ htsky_get_spectral_band_bounds
return RES_OK;
}
+res_T
+htsky_get_raw_spectral_bounds(const struct htsky* sky, double wavelengths[2])
+{
+ size_t n;
+ double band_first_bounds[2];
+ double band_last_bounds[2];
+ size_t iband_first;
+ size_t iband_last;
+ ASSERT(sky && wavelengths);
+
+ n = htsky_get_spectral_bands_count(sky);
+
+ iband_first = htsky_get_spectral_band_id(sky, 0);
+ iband_last = htsky_get_spectral_band_id(sky, n-1);
+
+ HTSKY(get_spectral_band_bounds(sky, iband_first, band_first_bounds));
+ HTSKY(get_spectral_band_bounds(sky, iband_last, band_last_bounds));
+ wavelengths[0] = MMIN(band_first_bounds[0], band_last_bounds[0]);
+ wavelengths[1] = MMAX(band_first_bounds[1], band_last_bounds[1]);
+
+ return RES_OK;
+}
+
int
htsky_is_long_wave(const struct htsky* htsky)
{
diff --git a/src/htsky.h b/src/htsky.h
@@ -206,6 +206,13 @@ htsky_get_spectral_band_bounds
const size_t iband,
double wavelengths[2]);
+/* Retrieve the boundaries raw sky data overlapped. This range is NOT clamped
+ * against the user defined spectral range */
+HTSKY_API res_T
+htsky_get_raw_spectral_bounds
+ (const struct htsky* sky,
+ double wavelengths[2]);
+
HTSKY_API int
htsky_is_long_wave
(const struct htsky* sky);