MCPcopy Create free account
hub / github.com/5ocworkshop/bgraph / x_to_value

Method x_to_value

src/classes/cls_graph.rs:153–158  ·  view source on GitHub ↗

Map an X coordinate to a value in x_range

(&self, x: u16, width: u16)

Source from the content-addressed store, hash-verified

151
152 /// Map an X coordinate to a value in x_range
153 fn x_to_value(&self, x: u16, width: u16) -> f32 {
154 let (start, end) = self.x_range;
155 let denom = if width > 1 { (width - 1) as f32 } else { 1.0 };
156 let normalized = x as f32 / denom;
157 start + normalized * (end - start)
158 }
159
160 /// Map a value to a vertical level (0-4) for Braille rendering
161 fn value_to_level(&self, value: f32, height: u16, cell_y: u16) -> usize {

Callers 1

renderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected