diff --git a/geo-types/src/polygon.rs b/geo-types/src/polygon.rs index 1fae8b717..9b9403814 100644 --- a/geo-types/src/polygon.rs +++ b/geo-types/src/polygon.rs @@ -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. @@ -426,3 +426,9 @@ impl From> for Polygon { ) } } + +impl From> for Polygon { + fn from(t: Triangle) -> Polygon { + Polygon::new(vec![t.0, t.1, t.2, t.0].into(), Vec::new()) + } +}