We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 89a2bf5 commit e90a9d6Copy full SHA for e90a9d6
src/camera.rs
@@ -39,7 +39,6 @@ impl Camera {
39
eprintln!("\rDone. \n");
40
}
41
fn initialize(&mut self) {
42
- // Fix image stretcheness
43
self.image_height = (self.image_width as f32/self.aspect_ratio) as i32;
44
self.image_height = if self.image_height < 1 {1} else {self.image_height};
45
@@ -48,7 +47,7 @@ impl Camera {
48
47
self.center = Point3::from(0.0, 0.0, 0.0);
49
let focal_length = 1.0f32;
50
let viewport_height = 2.0f32;
51
- let viewport_width = viewport_height * ((self.image_width/self.image_height) as f32);
+ let viewport_width = viewport_height * (self.image_width as f32/self.image_height as f32);
52
53
let viewport_u = Vec3::from(viewport_width, 0.0, 0.0);
54
let viewport_v = Vec3::from(0.0, -viewport_height, 0.0);
0 commit comments