From 49ace432b7e1e36e63fe17287c261d1cfd6144a6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 12 Apr 2022 14:59:10 +0200 Subject: [PATCH] Make `Triangle::from_points` more flexible --- fj-math/src/triangle.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fj-math/src/triangle.rs b/fj-math/src/triangle.rs index 6671ac55a..11db6830b 100644 --- a/fj-math/src/triangle.rs +++ b/fj-math/src/triangle.rs @@ -16,7 +16,9 @@ impl Triangle { /// # Panics /// /// Panics, if the points don't form a triangle. - pub fn from_points(points: [Point; 3]) -> Self { + pub fn from_points(points: [impl Into>; 3]) -> Self { + let points = points.map(Into::into); + let area = { let [a, b, c] = points.map(Point::to_xyz); (b - a).cross(&(c - a)).magnitude()