mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 18:45:55 +00:00
Lumps: a face-source table of another length is refused, never sliced
Body::parts (and so Body::lumps) mapped each piece's faces through the
body's face-source table with a silent `get`, so a table shorter or longer
than the body's faces gave its pieces sources of other faces, or none. The
table is by face position: one whose length is not the body's face count
belongs to another body. The pieces are now refused with "lumps: face
source table does not match the body", as before the SMLib port (the check
went with the old lumps_with_clearance in 66e31bede).
Fixes kernel body::lump_tests::grouping_lumps_does_not_infer_absent_or_misaligned_sources.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1351,6 +1351,10 @@ impl Body {
|
||||
pub fn parts(&self, groups: &[Vec<usize>]) -> Result<Vec<Body>> {
|
||||
let regions = self.record.material_regions();
|
||||
let counts = [(self.face_count(), self.edge_count())];
|
||||
// Sources are by face position: a table of another length belongs to another body.
|
||||
if self.face_sources.as_ref().is_some_and(|all| all.len() != self.face_count()) {
|
||||
return Err(KernelError::Invalid("lumps: face source table does not match the body".into()));
|
||||
}
|
||||
groups
|
||||
.iter()
|
||||
.map(|group| {
|
||||
|
||||
Reference in New Issue
Block a user