mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-06 20:02:16 +00:00
kernel: merged topology counts no seam edge (a face on both sides of it)
Case tessellation/818 counts a whole cylinder's seam since circles are one closed arc (42 edges, want 40, 'no seams'). Not built or run yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
@@ -122,6 +122,8 @@ pub fn merged_topology(b: &Body, mesh: &Mesh) -> Result<TopoCounts> {
|
||||
let mut weld_e: HashMap<(usize, usize, (i64, i64, i64)), usize> = HashMap::new();
|
||||
let mut welded_faces: Vec<Vec<usize>> = Vec::new();
|
||||
let mut welded_ends: Vec<(usize, usize)> = Vec::new();
|
||||
// How many face uses each welded edge has (a seam: two, on one face).
|
||||
let mut welded_uses: Vec<usize> = Vec::new();
|
||||
// A record edge standing for each welded edge (for its points).
|
||||
let mut rep: Vec<u32> = Vec::new();
|
||||
for (ei, (e, between)) in record.edges.iter().zip(edge_faces(record)).enumerate() {
|
||||
@@ -133,8 +135,12 @@ pub fn merged_topology(b: &Body, mesh: &Mesh) -> Result<TopoCounts> {
|
||||
if we == welded_faces.len() {
|
||||
welded_faces.push(Vec::new());
|
||||
welded_ends.push((a, z));
|
||||
welded_uses.push(0);
|
||||
rep.push(ei as u32);
|
||||
}
|
||||
if let Some(n) = welded_uses.get_mut(we) {
|
||||
*n += e.uses.len();
|
||||
}
|
||||
if let Some(fs) = welded_faces.get_mut(we) {
|
||||
for f in between {
|
||||
if !fs.contains(&f) {
|
||||
@@ -206,8 +212,12 @@ pub fn merged_topology(b: &Body, mesh: &Mesh) -> Result<TopoCounts> {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// An edge between two pieces of one merged face, or a seam (one face on both its sides),
|
||||
// is no edge of the merged topology; one face on one side only is an open edge.
|
||||
let seam = welded_uses.get(we).is_some_and(|n| *n >= 2);
|
||||
let pair = match gs[..] {
|
||||
[a, b] if a == b => continue,
|
||||
[_] if seam => continue,
|
||||
[a, b] => (a.min(b), a.max(b)),
|
||||
[a] => (a, a),
|
||||
_ => (usize::MAX, usize::MAX),
|
||||
|
||||
Reference in New Issue
Block a user