htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit d8a5a482768493a0d1d98494e5ceec33fb628712
parent 18e3e6b0f201ada4198a80a6d0685e0463e9fa52
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  9 Dec 2022 16:08:02 +0100

planeto: add the htrdr_planeto_source_get_spectral_range function

Diffstat:
Msrc/planeto/htrdr_planeto_source.c | 29+++++++++++++++++++++++++++++
Msrc/planeto/htrdr_planeto_source.h | 5+++++
2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/planeto/htrdr_planeto_source.c b/src/planeto/htrdr_planeto_source.c @@ -341,3 +341,32 @@ htrdr_planeto_source_is_targeted return d3_dot(dir, main_dir) >= cos(half_angle); } + +res_T +htrdr_planeto_source_get_spectral_range + (const struct htrdr_planeto_source* source, + double range[2]) +{ + res_T res = RES_OK; + ASSERT(source && range); + + if(!source->per_wlen_radiances) { + range[0] = 0; + range[1] = INF; + } else { + struct sbuf_desc desc = SBUF_DESC_NULL; + const source_radiance_T* spectrum = NULL; + + res = sbuf_get_desc(source->per_wlen_radiances, &desc); + if(res != RES_OK) goto error; + + spectrum = desc.buffer; + range[0] = spectrum[0].wavelength; + range[1] = spectrum[desc.size-1].wavelength; + } + +exit: + return res; +error: + goto exit; +} diff --git a/src/planeto/htrdr_planeto_source.h b/src/planeto/htrdr_planeto_source.h @@ -67,4 +67,9 @@ htrdr_planeto_source_is_targeted const double pos[3], /* Ray origin */ const double dir[3]);/* Ray direction */ +extern LOCAL_SYM res_T +htrdr_planeto_source_get_spectral_range + (const struct htrdr_planeto_source* source, + double range[2]); /* In nm. Limits are inclusive */ + #endif /* HTRDR_PLANETO_SOURCE_H */