emesh_core/
polygon.rs

1use crate::Error;
2use nalgebra::Point3;
3
4#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5pub struct IndexedPolygon {
6    vertices: Vec<usize>,
7}
8
9impl IndexedPolygon {
10    pub fn new(vertices: Vec<usize>) -> Result<Self, Error> {
11        Ok(Self { vertices })
12    }
13
14    pub fn vertices(&self) -> &Vec<usize> {
15        &self.vertices
16    }
17}
18
19#[derive(Debug, Clone, PartialEq)]
20pub struct Polygon {
21    vertices: Vec<Point3<f64>>,
22}
23
24impl Polygon {
25    pub fn new(vertices: Vec<Point3<f64>>) -> Result<Self, Error> {
26        Ok(Self { vertices })
27    }
28
29    pub fn vertices(&self) -> &Vec<Point3<f64>> {
30        &self.vertices
31    }
32}