refactor(kernel): number profile loops once and record face history as faces are built
One numbered loop type (crate::numbered) carries each segment's profile numbers through orientation, snapping, circle re-seaming, re-sampling and rotation; every builder orients its regions through it once. Builders that make their own side faces pair each face with its provenance as it is made (ruled walls by the wire edges each face holds, smooth lofts, coils and path sweeps by segment), and cap_and_close appends the caps itself. Column following is kept only for faces truck sweeps internally (rsweep, tsweep along paths, cones, where an apex vertex stays put). Extrude derives face sources and history in one topology pass. One attach entry point takes operands with their edges already indexed. Geometry, face order, face sources and recorded origins are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J53sR6gEaVt56soFDpTck8
This commit is contained in:
1 parent
8c81bc60d0
commit
d69ebbee1b
13 files changed
+705
-527
No files matched your search
@@ -117,13 +117,18 @@ impl History {
|
||||
/// Check that this history describes `result` made from `operands`: one entry per face and
|
||||
/// edge, and every origin within its operand's faces and edges.
|
||||
pub fn check(&self, result: &Body, operands: &[&Body]) -> Result<()> {
|
||||
if self.operands != operands.len() {
|
||||
let counts: Vec<(usize, usize)> = operands.iter().map(|b| (b.face_count(), b.edge_count())).collect();
|
||||
self.check_counts((result.face_count(), result.edge_count()), &counts)
|
||||
}
|
||||
|
||||
/// [`History::check`] against the result's and each operand's face and edge counts.
|
||||
pub(crate) fn check_counts(&self, result: (usize, usize), counts: &[(usize, usize)]) -> Result<()> {
|
||||
if self.operands != counts.len() {
|
||||
return Err(failed("operand count does not match"));
|
||||
}
|
||||
if self.faces.len() != result.face_count() || self.edges.len() != result.edge_count() {
|
||||
if self.faces.len() != result.0 || self.edges.len() != result.1 {
|
||||
return Err(failed("entries do not match the result's faces and edges"));
|
||||
}
|
||||
let counts: Vec<(usize, usize)> = operands.iter().map(|b| (b.face_count(), b.edge_count())).collect();
|
||||
let face_ok = |o: &FaceOrigin| match *o {
|
||||
FaceOrigin::Face { operand, face } | FaceOrigin::Offset { operand, face } => counts.get(operand).is_some_and(|c| face < c.0),
|
||||
FaceOrigin::Edge { operand, edge } => counts.get(operand).is_some_and(|c| edge < c.1),
|
||||
|
||||
Reference in new issue
Block a user