From fe186e0b7ddfd4e2512299fc6da8c057264fbe79 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 4 May 2023 11:37:22 +0200 Subject: [PATCH] Use richer face representation in `Tetrahedron` --- crates/fj-kernel/src/operations/build/shell.rs | 18 +++++++++--------- crates/fj-kernel/src/validate/shell.rs | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/fj-kernel/src/operations/build/shell.rs b/crates/fj-kernel/src/operations/build/shell.rs index 5bd57f56b..38f56e2f9 100644 --- a/crates/fj-kernel/src/operations/build/shell.rs +++ b/crates/fj-kernel/src/operations/build/shell.rs @@ -2,12 +2,11 @@ use fj_math::Point; use crate::{ objects::{Face, Shell}, - operations::{Insert, JoinCycle, UpdateFace}, + operations::{Insert, IsInsertedYes, JoinCycle, UpdateFace}, services::Services, - storage::Handle, }; -use super::BuildFace; +use super::{BuildFace, Polygon}; /// Build a [`Shell`] pub trait BuildShell { @@ -58,8 +57,9 @@ pub trait BuildShell { .insert(services) }); - let faces = [abc, bad, dac, cbd].map(|face| face.insert(services).face); - let shell = Shell::new(faces.clone()); + let faces = [abc, bad, dac, cbd].map(|face| face.insert(services)); + let shell = + Shell::new(faces.iter().map(|triangle| triangle.face.clone())); let [abc, bad, dac, cbd] = faces; @@ -87,14 +87,14 @@ pub struct Tetrahedron { pub shell: Shell, /// The face formed by the points `a`, `b`, and `c`. - pub abc: Handle, + pub abc: Polygon<3, IsInsertedYes>, /// The face formed by the points `b`, `a`, and `d`. - pub bad: Handle, + pub bad: Polygon<3, IsInsertedYes>, /// The face formed by the points `d`, `a`, and `c`. - pub dac: Handle, + pub dac: Polygon<3, IsInsertedYes>, /// The face formed by the points `c`, `b`, and `d`. - pub cbd: Handle, + pub cbd: Polygon<3, IsInsertedYes>, } diff --git a/crates/fj-kernel/src/validate/shell.rs b/crates/fj-kernel/src/validate/shell.rs index ed5d214b6..c20622333 100644 --- a/crates/fj-kernel/src/validate/shell.rs +++ b/crates/fj-kernel/src/validate/shell.rs @@ -210,7 +210,7 @@ mod tests { [[0., 0., 0.], [0., 1., 0.], [1., 0., 0.], [0., 0., 1.]], &mut services, ); - let invalid = valid.shell.update_face(&valid.abc, |face| { + let invalid = valid.shell.update_face(&valid.abc.face, |face| { face.update_exterior(|cycle| { cycle .update_nth_half_edge(0, |half_edge| { @@ -243,7 +243,7 @@ mod tests { [[0., 0., 0.], [0., 1., 0.], [1., 0., 0.], [0., 0., 1.]], &mut services, ); - let invalid = valid.shell.remove_face(&valid.abc); + let invalid = valid.shell.remove_face(&valid.abc.face); valid.shell.validate_and_return_first_error()?; assert_contains_err!(