MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / Remap

Function Remap

include/luxrays/utils/utils.h:331–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329
330// Remap a value that is in sourceRange into targetRange.
331template <class T> T inline Remap(const T value,
332 const T sourceMin, const T sourceMax,
333 const T targetMin, const T targetMax) {
334 if (sourceMin == sourceMax)
335 return sourceMin;
336
337 return (value - sourceMin)
338 * (targetMax - targetMin)
339 / (sourceMax - sourceMin)
340 + targetMin;
341}
342
343inline bool IsValid(float a) {
344 return !isnan(a) && !isinf(a) && (a >= 0.f);

Callers 1

ClampedRemapMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected