diff --git a/ezgui/src/lib.rs b/ezgui/src/lib.rs index 37687ceb13..70661f582e 100644 --- a/ezgui/src/lib.rs +++ b/ezgui/src/lib.rs @@ -98,8 +98,6 @@ impl<'a> GfxCtx<'a> { ); } - // TODO triangulate the points here, or remove this and just have a version that draws - // triangles pub fn draw_polygon(&mut self, color: Color, poly: &geom::Polygon) { for pts in poly.for_drawing().iter() { graphics::Polygon::new(color).draw( diff --git a/geom/src/polygon.rs b/geom/src/polygon.rs index 03d090e70d..c3eb520d39 100644 --- a/geom/src/polygon.rs +++ b/geom/src/polygon.rs @@ -88,7 +88,7 @@ impl Polygon { pub fn for_drawing(&self) -> Vec> { self.triangles .iter() - .map(|tri| vec![tri.pt1.to_vec(), tri.pt2.to_vec(), tri.pt3.to_vec()]) + .map(|tri| vec![to_vec(tri.pt1), to_vec(tri.pt2), to_vec(tri.pt3)]) .collect() } @@ -170,3 +170,7 @@ fn is_clockwise_polygon(pts: &Vec) -> bool { } sum > 0.0 } + +fn to_vec(pt: Pt2D) -> Vec2d { + [pt.x(), pt.y()] +} diff --git a/geom/src/pt.rs b/geom/src/pt.rs index 44104fc781..37d57cc430 100644 --- a/geom/src/pt.rs +++ b/geom/src/pt.rs @@ -1,4 +1,3 @@ -use graphics::math::Vec2d; use ordered_float::NotNaN; use std::f64; use std::fmt; @@ -54,11 +53,6 @@ impl Pt2D { self.y } - // TODO probably remove this - pub fn to_vec(&self) -> Vec2d { - [self.x(), self.y()] - } - // TODO better name // TODO Meters for dist? pub fn project_away(&self, dist: f64, theta: Angle) -> Pt2D { diff --git a/map_model/src/geometry.rs b/map_model/src/geometry.rs index 9f25551c5f..73fd6c3c88 100644 --- a/map_model/src/geometry.rs +++ b/map_model/src/geometry.rs @@ -71,7 +71,3 @@ pub fn regular_polygon(center: Pt2D, sides: usize, length: f64) -> Polygon { pts.push(first_pt); Polygon::new(&pts) } - -pub fn drawing_line(l: &Line) -> [f64; 4] { - [l.pt1().x(), l.pt1().y(), l.pt2().x(), l.pt2().y()] -}