cleaned up a bit
This commit is contained in:
19
src/main.rs
19
src/main.rs
@@ -157,37 +157,20 @@ fn clock() {
|
||||
let mut canvas = Canvas::new(1024, 1024);
|
||||
let color = Color::new(1.0, 0.0, 0.0);
|
||||
let middle = 1024.0 / 2.0;
|
||||
let three_fourths_middle = middle / 4.0 * 3.0;
|
||||
let center = &Tuple::point_zero() * &Matrix::translation(0.0, 1.0, 0.0);
|
||||
// canvas.write_pixel(center.x() as usize, center.y() as usize, color);
|
||||
canvas.write_pixel(middle as usize, middle as usize, Color::new(0.0, 1.0, 0.0));
|
||||
|
||||
for i in 1..13 {
|
||||
let twelve = Tuple::point_zero();
|
||||
|
||||
let twelve = &Matrix::translation(0.0, -12.0, 0.0) * &twelve;
|
||||
let twelve = &Matrix::translation(0.0, -24.0, 0.0) * &twelve;
|
||||
let twelve = &Matrix::scaling(0.0, 10.0, 0.0) * &twelve;
|
||||
let twelve = &Matrix::rotation_z((i as f32 / 12.0) * (2.0 * PI)) * &twelve;
|
||||
let twelve = &Matrix::translation(middle, middle, 0.0) * &twelve;
|
||||
println!("{}", twelve);
|
||||
|
||||
canvas.write_pixel(twelve.x() as usize, twelve.y() as usize, color);
|
||||
|
||||
}
|
||||
//for i in 0..=-1 {
|
||||
// let position = ((2.0 * PI) / 12.0) * (i as f32);
|
||||
// println!("i: {} pos: {}", i, position);
|
||||
// let transform = &(&(&Matrix::identity(4)
|
||||
// * &Matrix::translation(0.0, 1.0 , 0.0))
|
||||
// * &Matrix::rotation_z(position))
|
||||
// //* &Matrix::identity(4))
|
||||
// * &Matrix::translation(middle, middle, 0.0);
|
||||
// let point = &Tuple::point_zero() * &(&transform * &Matrix::scaling(three_fourths_middle, three_fourths_middle, 0.0));
|
||||
// //let point = &Tuple::point_zero() * &(&Matrix::translation(i as f32 * 6.0, 0.0, 0.0) * &Matrix::translation(middle, middle, 0.0));
|
||||
// println!("point rotated: {}", &point);
|
||||
// canvas.write_pixel(point.x() as usize, point.y() as usize, color);
|
||||
|
||||
//}
|
||||
write_canvas_to_file(canvas, "clock.ppm");
|
||||
|
||||
println!("Ending clock!");
|
||||
|
||||
Reference in New Issue
Block a user