From e01e14d4dacda37bb736ced5074dffca352dfd09 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Sat, 9 Apr 2022 15:20:12 +0200 Subject: [PATCH] Add `PolyChain::new` --- fj-math/src/poly_chain.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fj-math/src/poly_chain.rs b/fj-math/src/poly_chain.rs index 8f566cb58..f9726384e 100644 --- a/fj-math/src/poly_chain.rs +++ b/fj-math/src/poly_chain.rs @@ -11,6 +11,11 @@ pub struct PolyChain { } impl PolyChain { + /// Create an empty `PolyChain` + pub fn new() -> Self { + Self { points: Vec::new() } + } + /// Construct a polygonal chain from a number of points pub fn from_points( points: impl IntoIterator>>, @@ -48,6 +53,12 @@ impl PolyChain { } } +impl Default for PolyChain { + fn default() -> Self { + Self::new() + } +} + impl From for PolyChain where P: Into>,