mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-27 09:35:52 +00:00
Convert tuple struct into regular struct
This commit is contained in:
parent
98c28517cc
commit
d7a8a2935b
@ -8,24 +8,26 @@ use super::handle::{Handle, Storage};
|
|||||||
|
|
||||||
/// The faces of a shape
|
/// The faces of a shape
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
||||||
pub struct Faces(pub(super) Vec<Face>);
|
pub struct Faces {
|
||||||
|
pub(super) faces: Vec<Face>,
|
||||||
|
}
|
||||||
|
|
||||||
impl Faces {
|
impl Faces {
|
||||||
/// Add a face to the shape
|
/// Add a face to the shape
|
||||||
pub fn add(&mut self, face: Face) -> Handle<Face> {
|
pub fn add(&mut self, face: Face) -> Handle<Face> {
|
||||||
self.0.push(face.clone());
|
self.faces.push(face.clone());
|
||||||
Storage::new(face).handle()
|
Storage::new(face).handle()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check whether the shape contains a specific face
|
/// Check whether the shape contains a specific face
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub fn contains(&self, face: &Face) -> bool {
|
pub fn contains(&self, face: &Face) -> bool {
|
||||||
self.0.contains(face)
|
self.faces.contains(face)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access an iterator over all faces
|
/// Access an iterator over all faces
|
||||||
pub fn all(&self) -> impl Iterator<Item = Face> + '_ {
|
pub fn all(&self) -> impl Iterator<Item = Face> + '_ {
|
||||||
self.0.iter().cloned()
|
self.faces.iter().cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn triangles(
|
pub fn triangles(
|
||||||
@ -34,7 +36,7 @@ impl Faces {
|
|||||||
out: &mut Vec<Triangle<3>>,
|
out: &mut Vec<Triangle<3>>,
|
||||||
debug_info: &mut DebugInfo,
|
debug_info: &mut DebugInfo,
|
||||||
) {
|
) {
|
||||||
for face in &self.0 {
|
for face in &self.faces {
|
||||||
face.triangles(tolerance, out, debug_info);
|
face.triangles(tolerance, out, debug_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ impl Shape {
|
|||||||
|
|
||||||
vertices: VerticesInner::new(),
|
vertices: VerticesInner::new(),
|
||||||
cycles: CyclesInner::new(),
|
cycles: CyclesInner::new(),
|
||||||
faces: Faces(Vec::new()),
|
faces: Faces { faces: Vec::new() },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user