Skip to content

Commit 86ffdb7

Browse files
author
Josh Leverette
committed
Increased luminosity of stars to make them easier to see, no longer printing star info for every single matching star.
1 parent 6e6ae3b commit 86ffdb7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,23 @@ fn main() {
7373
let mut window = Window::new(&format!("Stars within {:.3} lightyears", maxdist * 3.26156));
7474
window.set_framerate_limit(Some(75));
7575
window.set_light(Light::StickToCamera);
76+
// print only the first ten stars within range, rather
77+
// than spending forever printing out the matching stars.
78+
// this should be adjustable in the future.
79+
for star in (&named_vec).into_iter().take(10) {
80+
println!("{:.3} lightyears\n{:?}\n\n", star.distance * 3.26156, star);
81+
}
7682
for star in named_vec {
7783
let mut sph = window.add_sphere(0.015);
7884
if star.id == 0 {
7985
sph.set_color(1.0, 1.0, 0.7);
8086
} else {
8187
let (r, g, b) = star.bv2rgb_opt().or(Some((1.0, 1.0, 1.0))).unwrap();
8288
let mag = star.magnitude as f32;
83-
let lum = 2.512f32.powf(-mag);
89+
let lum = f32::min(250.0 * 2.512f32.powf(-mag), 1.0);
8490
sph.set_color(r * lum, g * lum, b * lum);
8591
}
8692
sph.append_translation(&Vector3::new(star.x as f32, star.y as f32, star.z as f32));
87-
println!("{:.3} lightyears\n{:?}\n\n", star.distance * 3.26156, star);
8893
}
8994
println!("There were {} matching stars.", starcount);
9095
println!("Processing took {} seconds",

0 commit comments

Comments
 (0)