forked from 1b-agent/fieldcraft-upstream
mesh: format
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
7b7d38fabd
commit
e4233ff794
2 files changed
+9
-3
No files matched your search
@@ -560,7 +560,9 @@ pub(crate) fn fixed_patch(s: &Session, b: &Body, body: &str, names: &[String], s
|
|||||||
for l in quad {
|
for l in quad {
|
||||||
let hit = *on.entry(l).or_insert_with(|| {
|
let hit = *on.entry(l).or_insert_with(|| {
|
||||||
let x = s.model.node(l)?.xyz;
|
let x = s.model.node(l)?.xyz;
|
||||||
faces.iter().position(|&f| b.target.project(f, x).is_some_and(|q| (0..3).map(|k| (q[k] - x[k]).powi(2)).sum::<f64>().sqrt() <= tol))
|
faces
|
||||||
|
.iter()
|
||||||
|
.position(|&f| b.target.project(f, x).is_some_and(|q| (0..3).map(|k| (q[k] - x[k]).powi(2)).sum::<f64>().sqrt() <= tol))
|
||||||
});
|
});
|
||||||
lies &= hit.is_some();
|
lies &= hit.is_some();
|
||||||
}
|
}
|
||||||
@@ -579,7 +581,9 @@ pub(crate) fn fixed_patch(s: &Session, b: &Body, body: &str, names: &[String], s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if patch.quads.is_empty() {
|
if patch.quads.is_empty() {
|
||||||
return Err(EngineError::Params(format!("`fixed`: no other body's mesh has element faces on faces {names:?} of `{body}`; mesh the neighbour first")));
|
return Err(EngineError::Params(format!(
|
||||||
|
"`fixed`: no other body's mesh has element faces on faces {names:?} of `{body}`; mesh the neighbour first"
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
Ok(patch)
|
Ok(patch)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,7 +275,9 @@ fn a_fixed_face_takes_the_neighbours_mesh_as_given() {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|e| c.elements().get(&e).map(|t| t.faces.keys().map(|&f| (e, f)).collect::<Vec<_>>()).unwrap_or_default())
|
.flat_map(|e| c.elements().get(&e).map(|t| t.faces.keys().map(|&f| (e, f)).collect::<Vec<_>>()).unwrap_or_default())
|
||||||
.filter(|&(element, face)| {
|
.filter(|&(element, face)| {
|
||||||
s.model.face_nodes(fieldcraft_model::ElementFace { element, face }).is_some_and(|ns| ns.iter().all(|n| (s.model.node(*n).unwrap().xyz[2] - z).abs() < 1e-9))
|
s.model
|
||||||
|
.face_nodes(fieldcraft_model::ElementFace { element, face })
|
||||||
|
.is_some_and(|ns| ns.iter().all(|n| (s.model.node(*n).unwrap().xyz[2] - z).abs() < 1e-9))
|
||||||
})
|
})
|
||||||
.count()
|
.count()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user