1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
use super::Path; /// A closed 2D outline plus optional holes. Mirrors three.js's `Shape`. pub struct Shape { pub outline: Path, pub holes: Vec<Path>, } impl Default for Shape { fn default() -> Self { Self::new() } } impl Shape { pub fn new() -> Self { Self { outline: Path::new(), holes: Vec::new(), } } pub fn from_path(outline: Path) -> Self { Self { outline, holes: Vec::new(), } } pub fn add_hole(&mut self, hole: Path) -> &mut Self { self.holes.push(hole); self } }