MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / world_to_ndc

Method world_to_ndc

src/plot_renderer/shader.rs:379–389  ·  view source on GitHub ↗
(&self, world: [f64; 2], camera: &crate::camera::Camera)

Source from the content-addressed store, hash-verified

377 bounds_h: 0,
378 bounds: Rectangle::default(),
379 scale_factor: 1.0,
380 }
381 }
382
383 // Coordinate conversion helpers
384 fn screen_to_clip(&self, x: f32, y: f32) -> [f32; 2] {
385 let w = self.bounds_w.max(1) as f32;
386 let h = self.bounds_h.max(1) as f32;
387 [(x / w) * 2.0 - 1.0, 1.0 - (y / h) * 2.0]
388 }
389
390 fn world_to_ndc(&self, world: [f64; 2], camera: &crate::camera::Camera) -> [f32; 2] {
391 let render_pos = [
392 (world[0] - camera.render_offset.x) as f32,

Callers 1

rebuild_highlightMethod · 0.80

Calls 1

effective_positionMethod · 0.80

Tested by

no test coverage detected