forked from 1b-agent/fieldcraft-upstream
geometry.face.absorb: tiny and sliver faces into a neighbour (#506)
A face merge may keep one of its faces' names (Merge::into, model FaceMerge::into): absorbing a tiny face leaves the neighbour by its own name, so sets on it still select it. Shape::absorbing_neighbour finds the face a tiny one shares the longest edges with. geometry.face.absorb absorbs one face (into a named or the best neighbour) or, from_check, every small and sliver face the last geometry.check marked; check marks now carry the small face they found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
ce02d263c7
commit
58174ba168
14 files changed
+283
-27
No files matched your search
@@ -444,7 +444,9 @@ fn check(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
} else {
|
||||
f.face_indices.iter().map(|&i| (f.body.clone(), i)).collect()
|
||||
};
|
||||
crate::view::GeometryMark { faces, path: f.path.clone(), at: f.at }
|
||||
let small =
|
||||
matches!(f.kind, Kind::SmallFace | Kind::SliverFace).then(|| f.faces.first().map(|n| (f.body.clone(), n.clone()))).flatten();
|
||||
crate::view::GeometryMark { faces, path: f.path.clone(), at: f.at, small }
|
||||
})
|
||||
.collect();
|
||||
Arc::new(crate::view::GeometryMarks { design: Arc::downgrade(design), marks })
|
||||
@@ -522,13 +524,13 @@ fn import_mesh(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
pub(crate) mod tests {
|
||||
use std::io::{Cursor, Write};
|
||||
|
||||
use super::*;
|
||||
|
||||
/// A session with the design the SolidCraft `commands` build open.
|
||||
fn design(commands: Value) -> (crate::tests::TempDir, Session) {
|
||||
pub(crate) fn design(commands: Value) -> (crate::tests::TempDir, Session) {
|
||||
let bytes = fieldcraft_geometry::script_design(&json!({"commands": commands}).to_string()).unwrap();
|
||||
let (dir, path) = crate::tests::design_file(&bytes);
|
||||
let mut s = Session::default();
|
||||
|
||||
Reference in new issue
Block a user