@@ -73,18 +73,23 @@ fn main() {
73
73
let mut window = Window :: new ( & format ! ( "Stars within {:.3} lightyears" , maxdist * 3.26156 ) ) ;
74
74
window. set_framerate_limit ( Some ( 75 ) ) ;
75
75
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
+ }
76
82
for star in named_vec {
77
83
let mut sph = window. add_sphere ( 0.015 ) ;
78
84
if star. id == 0 {
79
85
sph. set_color ( 1.0 , 1.0 , 0.7 ) ;
80
86
} else {
81
87
let ( r, g, b) = star. bv2rgb_opt ( ) . or ( Some ( ( 1.0 , 1.0 , 1.0 ) ) ) . unwrap ( ) ;
82
88
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 ) ;
84
90
sph. set_color ( r * lum, g * lum, b * lum) ;
85
91
}
86
92
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) ;
88
93
}
89
94
println ! ( "There were {} matching stars." , starcount) ;
90
95
println ! ( "Processing took {} seconds" ,
0 commit comments