From 9e520d5f9354dbb9b22ab1cfc487af0bbf710f68 Mon Sep 17 00:00:00 2001 From: Seaton Ullberg Date: Sun, 29 Mar 2020 22:15:53 -0400 Subject: [PATCH] Fix issue #429 --- geo-types/src/polygon.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/geo-types/src/polygon.rs b/geo-types/src/polygon.rs index 1fae8b7175..9b94038149 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()) + } +}