summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 13f13da..8831976 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,6 +23,7 @@ fn main() {
let b = Lerp::new(vec![400.0, 140.0, 500.0, 300.0]);
let pa = poly::lp(a);
let pb = poly::lp(b);
+ let p = poly::gcd(&pa, &pb);
let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
@@ -51,10 +52,13 @@ fn main() {
for t in 0..800 {
let x = eval_poly(&pa, t as Number / 800.0);
let y = eval_poly(&pb, t as Number / 800.0);
+ let z = eval_poly(&p, t as Number / 800.0);
canvas.set_draw_color(Color::RGB(180, 20, 20));
canvas.fill_rect(Rect::new(t, x as i32, 5, 5)).unwrap();
canvas.set_draw_color(Color::RGB(20, 180, 20));
canvas.fill_rect(Rect::new(t, y as i32, 5, 5)).unwrap();
+ canvas.set_draw_color(Color::RGB(20, 20, 180));
+ canvas.fill_rect(Rect::new(t, z as i32, 5, 5)).unwrap();
}
canvas.present();