From 8fd993f0165aa3670129ea9e11395107e6a5cf19 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Wed, 30 Sep 2026 10:25:44 +0300 Subject: [PATCH] Point clouds: colour schemes run from their high end A scheme lists its colours from the highest value down (Spectrum: magenta at the highest intensity, red at the lowest), as the reference colours an intensity- or elevation-stylized cloud. Co-Authored-By: Claude Opus 5.5 --- src/scene/model/point_cloud/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scene/model/point_cloud/mod.rs b/src/scene/model/point_cloud/mod.rs index d35ebbefd..67182c1dc 100644 --- a/src/scene/model/point_cloud/mod.rs +++ b/src/scene/model/point_cloud/mod.rs @@ -421,7 +421,7 @@ impl Stylization { } } -/// The colour schemes a new drawing's colour map carries, low to high. +/// The colour schemes a new drawing's colour map carries, high end first. const BUILTIN_RAMPS: [(&str, &[u32]); 7] = [ ("Hydro", &[0x00bfff, 0x007ca5, 0x005f7f, 0x00394c, 0x00264c, 0x00134c, 0x00004c, 0x000026]), ("Grayscale", &[0xffffff, 0xcccccc, 0x999999, 0x666666, 0x333333, 0x000000]), @@ -465,9 +465,10 @@ fn ramp_colors(document: &CadDocument, id: &str, fallback: &str) -> Vec<[u8; 3]> } /// The colour at `t` (0–1, clamped) along a scheme: blended between its -/// colours, or the band `t` falls in. +/// colours, or the band `t` falls in. A scheme lists its high end first +/// (Spectrum: magenta at the highest value, red at the lowest). fn ramp(colors: &[[u8; 3]], t: f64, gradient: bool) -> [u8; 3] { - let t = if t.is_finite() { t.clamp(0.0, 1.0) } else { 0.0 }; + let t = 1.0 - if t.is_finite() { t.clamp(0.0, 1.0) } else { 0.0 }; if colors.len() < 2 { return colors.first().copied().unwrap_or([255; 3]); }