mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-25 16:45:52 +00:00
commit
1202b5dad6
@ -11,6 +11,11 @@ pub struct PolyChain<const D: usize> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<const D: usize> PolyChain<D> {
|
impl<const D: usize> PolyChain<D> {
|
||||||
|
/// Create an empty `PolyChain`
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self { points: Vec::new() }
|
||||||
|
}
|
||||||
|
|
||||||
/// Construct a polygonal chain from a number of points
|
/// Construct a polygonal chain from a number of points
|
||||||
pub fn from_points(
|
pub fn from_points(
|
||||||
points: impl IntoIterator<Item = impl Into<Point<D>>>,
|
points: impl IntoIterator<Item = impl Into<Point<D>>>,
|
||||||
@ -46,6 +51,18 @@ impl<const D: usize> PolyChain<D> {
|
|||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reverse the order of points in the `PolyChain`
|
||||||
|
pub fn reverse(mut self) -> Self {
|
||||||
|
self.points.reverse();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<const D: usize> Default for PolyChain<D> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P, Ps, const D: usize> From<Ps> for PolyChain<D>
|
impl<P, Ps, const D: usize> From<Ps> for PolyChain<D>
|
||||||
|
Loading…
Reference in New Issue
Block a user