diff --git a/fj-math/src/poly_chain.rs b/fj-math/src/poly_chain.rs index 8f566cb58..0c762226d 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>>, @@ -46,6 +51,18 @@ impl PolyChain { self } + + /// Reverse the order of points in the `PolyChain` + pub fn reverse(mut self) -> Self { + self.points.reverse(); + self + } +} + +impl Default for PolyChain { + fn default() -> Self { + Self::new() + } } impl From for PolyChain