diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index e5e4112..bd7e1a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,12 +14,10 @@ use sdl2::keyboard::Keycode; use sdl2::rect::Rect; fn main() { - //let a = Lerp::new(vec![2.0, -2.0, 2.0]); - //let b = Lerp::new(vec![-1.0, 1.0, 2.0]); - //let pa = lerp::lp(a); - //let pb = lerp::lp(b); - let pa = vec![1.0, 5.0, -2.0]; - let pb = vec![5.0, -4.0, 0.0]; + let a = Lerp::new(vec![2.0, -2.0, 2.0]); + let b = Lerp::new(vec![-1.0, 1.0, 2.0]); + let pa = lerp::lp(a); + let pb = lerp::lp(b); let p = poly::gcd(&pa, &pb); let sdl_context = sdl2::init().unwrap(); @@ -49,9 +47,9 @@ fn main() { let s = -600.0 / 10.0; let k = 600.0 / 2.0; for t in -800..800 { - let x = k + s * poly::eval_poly(&pa, t as Number / 100.0); - let y = k + s * poly::eval_poly(&pb, t as Number / 100.0); - let z = k + s * poly::eval_poly(&p, t as Number / 100.0); + let x = k + s * pa.eval(t as Number / 100.0); + let y = k + s * pb.eval(t as Number / 100.0); + let z = k + s * p.eval(t as Number / 100.0); canvas.set_draw_color(Color::RGB(180, 20, 20)); canvas.fill_rect(Rect::new(400 + t, x as i32, 5, 5)).unwrap(); canvas.set_draw_color(Color::RGB(20, 180, 20)); |