Skip to content

Commit

Permalink
Merge 9e520d5 into 2763279
Browse files Browse the repository at this point in the history
  • Loading branch information
seatonullberg committed Mar 30, 2020
2 parents 2763279 + 9e520d5 commit ad90410
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion geo-types/src/polygon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{CoordinateType, LineString, Point, Rect};
use crate::{CoordinateType, LineString, Point, Rect, Triangle};
use num_traits::{Float, Signed};

/// A bounded two-dimensional area.
Expand Down Expand Up @@ -426,3 +426,9 @@ impl<T: CoordinateType> From<Rect<T>> for Polygon<T> {
)
}
}

impl<T: CoordinateType> From<Triangle<T>> for Polygon<T> {
fn from(t: Triangle<T>) -> Polygon<T> {
Polygon::new(vec![t.0, t.1, t.2, t.0].into(), Vec::new())
}
}

0 comments on commit ad90410

Please sign in to comment.