use cadmpeg_ir::report::LossNote;
use crate::loss::StepLossCode;
const PCURVE_UNPROVED_NOTE_EXEMPLARS: usize = 8;
pub(super) struct PcurveAdmission {
pub(super) curve: u64,
pub(super) surface: u64,
pub(super) coedge_use: u64,
}
pub(super) fn pcurve_admission_note(admissions: &[PcurveAdmission]) -> Option<LossNote> {
if admissions.is_empty() {
return None;
}
let count = admissions.len();
let named = admissions
.iter()
.take(PCURVE_UNPROVED_NOTE_EXEMPLARS)
.map(|admission| {
format!(
"curve #{} on surface #{} at coedge use #{}",
admission.curve, admission.surface, admission.coedge_use
)
})
.collect::<Vec<_>>()
.join(", ");
let unnamed = count.saturating_sub(PCURVE_UNPROVED_NOTE_EXEMPLARS);
let more = if unnamed == 0 {
String::new()
} else {
format!(", and {unnamed} more")
};
Some(StepLossCode::PcurveGlobalFidelityUnproved.note(format!(
"a finite endpoint and locus witness admits {count} pcurve relation(s); global model-space point-set equality and direction are unproved: {named}{more}"
)))
}
#[cfg(test)]
mod tests;