MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / heatmap_color

Function heatmap_color

tools/bloom-diff/src/main.rs:240–250  ·  view source on GitHub ↗

Map a difference magnitude (0..1) to a false-color hot palette so small errors stay dark and big errors scream. Goes black → red → yellow → white, amplified so typical-tolerance errors (1-2%) are visible without manually setting a gain.

(magnitude: f32)

Source from the content-addressed store, hash-verified

238/// yellow → white, amplified so typical-tolerance errors (1-2%) are
239/// visible without manually setting a gain.
240fn heatmap_color(magnitude: f32) -> Rgb<u8> {
241 let m = (magnitude * 16.0).clamp(0.0, 1.0);
242 let r = (m * 3.0).clamp(0.0, 1.0);
243 let g = ((m - 0.33) * 3.0).clamp(0.0, 1.0);
244 let b = ((m - 0.66) * 3.0).clamp(0.0, 1.0);
245 Rgb([
246 (r * 255.0) as u8,
247 (g * 255.0) as u8,
248 (b * 255.0) as u8,
249 ])
250}
251
252fn write_heatmap(
253 reference: &[[f32; 3]],

Callers 2

write_heatmapFunction · 0.85
make_heatmap_bufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected