pub mod align;
pub mod assign;
mod congruent;
pub mod fingerprint;
use std::collections::{BTreeMap, BTreeSet};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use crate::features::{self, Features};
use crate::framed_records::{self, Mapped};
use crate::frames::{self, PartFrame, RecordFrame};
use crate::kernel::brep::Part;
use crate::kernel::geom::{self, V3};
use crate::published_records::PublishedFeatures;
pub use align::Motion;
pub use congruent::{congruent, congruent_with};
pub use fingerprint::{
FINGERPRINT_VERSION, FaceFingerprint, FeatureFingerprint, Fingerprints, fingerprint,
};
#[derive(Clone, Debug, Serialize)]
#[non_exhaustive]
pub struct Recognition {
#[serde(flatten)]
pub features: PublishedFeatures,
pub fingerprints: Fingerprints,
#[serde(skip)]
pub frame: RecordFrame,
#[serde(skip)]
pub source_sha256: Option<String>,
#[serde(skip)]
pub input_repairs: Vec<String>,
#[serde(skip)]
pub(crate) body_evidence: BTreeMap<usize, crate::recognition::BodyReason>,
}
pub fn recognise(part: &Part) -> Recognition {
let frame = match frames::infer_part_frame(part) {
Ok(frame) => frame,
Err(reason) => {
return features::recognise_with(part, |ctx, features| {
publish(part, ctx, features, RecordFrame::Refused { reason })
});
}
};
recognise_in_frame(part, frame)
}
fn recognise_in_frame(part: &Part, frame: PartFrame) -> Recognition {
let working = match part.transformed(&frame.normalisation()) {
Ok(working) => working,
Err(_) => {
return normalisation_refused(part);
}
};
features::recognise_with(&working, |ctx, features| {
publish(part, ctx, features, RecordFrame::Inferred(frame))
})
}
fn normalisation_refused(part: &Part) -> Recognition {
let features = Features::default();
Recognition {
fingerprints: fingerprint(part, &features),
features: features.into(),
frame: RecordFrame::Refused {
reason: frames::FrameRefusal::NonrigidFrame,
},
source_sha256: None,
input_repairs: part.input_repairs().to_vec(),
body_evidence: BTreeMap::new(),
}
}
fn publish(
part: &Part,
ctx: &features::Context<'_>,
features: Features,
frame: RecordFrame,
) -> Recognition {
if let RecordFrame::Inferred(inferred) = &frame {
let working = ctx.part;
let body_evidence = crate::body::evidence(working, &features);
let Mapped {
features,
fingerprinted,
motion,
} = framed_records::to_file(features, inferred, working);
let _ = motion;
let fingerprints = fingerprint::published_fingerprint_in(part, &fingerprinted, ctx);
Recognition {
features,
fingerprints,
frame,
source_sha256: None,
input_repairs: part.input_repairs().to_vec(),
body_evidence,
}
} else {
let features: PublishedFeatures = features.into();
let fingerprints = fingerprint::published_fingerprint_in(part, &features, ctx);
Recognition {
features,
fingerprints,
frame,
source_sha256: None,
input_repairs: part.input_repairs().to_vec(),
body_evidence: BTreeMap::new(),
}
}
}
pub fn recognise_with_evidence(part: &Part) -> RecognitionWithEvidence {
let (recognition, evidence) = joint_analysis(part);
RecognitionWithEvidence {
recognition,
evidence,
}
}
#[non_exhaustive]
pub struct RecognitionWithEvidence {
pub recognition: Recognition,
pub evidence:
Result<crate::evidence_view::EvidenceDocument, crate::evidence_view::EvidenceViewError>,
}
fn joint_analysis(
part: &Part,
) -> (
Recognition,
Result<crate::evidence_view::EvidenceDocument, crate::evidence_view::EvidenceViewError>,
) {
use crate::evidence_view::{self, EvidenceViewError};
let (frame, working) = match frames::infer_part_frame(part) {
Ok(frame) => match part.transformed(&frame.normalisation()) {
Ok(working) => (RecordFrame::Inferred(frame), Some(working)),
Err(_) => {
return (
normalisation_refused(part),
evidence_view::document(part, false),
);
}
},
Err(reason) => (RecordFrame::Refused { reason }, None),
};
let geometry = working.as_ref().unwrap_or(part);
let result = features::take_inventory(geometry, |ctx, mut inventory| {
let projection = features::project_recesses(ctx, &mut inventory);
let recognised = features::recognise_projected(ctx, inventory.clone(), projection.clone());
let recognition = publish(part, ctx, recognised, frame.clone());
let evidence = evidence_view::project(
geometry,
inventory,
projection.and_then(Result::ok).unwrap_or_default(),
)
.map(|view| {
let evidence_frame = match &frame {
RecordFrame::Inferred(frame) => Some(*frame),
_ => None,
};
evidence_view::document_from_view(part, evidence_frame, view)
});
(recognition, evidence)
});
result.unwrap_or_else(|error| {
let message = error.to_string();
let ctx = features::Context::new(geometry);
let refused = features::reconciliation_refusal(geometry, error);
(
publish(part, &ctx, refused, frame),
Err(EvidenceViewError(message)),
)
})
}
#[cfg(test)]
pub(crate) fn caller_space_recognise(part: &Part) -> Recognition {
features::recognise_with(part, |ctx, features| {
let features: PublishedFeatures = features.into();
let fingerprints = fingerprint::published_fingerprint_in(part, &features, ctx);
Recognition {
features,
fingerprints,
frame: RecordFrame::CallerSpace,
source_sha256: None,
input_repairs: part.input_repairs().to_vec(),
body_evidence: BTreeMap::new(),
}
})
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Thresholds {
pub same_rel: f64,
pub freeform_rel: f64,
pub position_tol: f64,
pub angle_tol: f64,
pub anchor_candidates: usize,
pub turn_candidates: usize,
pub anchor_pairs: usize,
pub hypotheses: usize,
pub min_inliers: usize,
pub min_inlier_fraction: f64,
pub semantics_weight: f64,
pub neighbourhood_weight: f64,
pub placement_weight: f64,
pub unaligned_placement: f64,
pub placement_reach: f64,
pub cutoff: f64,
pub margin: f64,
pub resolves: usize,
pub overlap: f64,
}
impl Default for Thresholds {
fn default() -> Self {
Thresholds {
same_rel: 1e-6,
freeform_rel: 1e-3,
position_tol: 1e-5,
angle_tol: 1e-5,
anchor_candidates: 4,
turn_candidates: 64,
anchor_pairs: 400,
hypotheses: 3000,
min_inliers: 3,
min_inlier_fraction: 0.5,
semantics_weight: 1.0,
neighbourhood_weight: 1.0,
placement_weight: 1.0,
unaligned_placement: 0.1,
placement_reach: 0.25,
cutoff: 1.0,
margin: 0.05,
resolves: 200,
overlap: 0.8,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Class {
Carried,
Adapted,
Ambiguous,
Orphaned,
New,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Alignment {
pub found: bool,
pub rotation: [[f64; 3]; 3],
pub translation: V3,
pub anchors: usize,
pub inliers: usize,
pub symmetric: bool,
pub axisymmetric: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub axis: Option<[V3; 2]>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fold: Option<usize>,
pub rms: f64,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Change {
pub old: Value,
pub new: Value,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Entry<T> {
pub old: T,
pub class: Class,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub new: Option<T>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub candidates: Vec<T>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub changes: BTreeMap<String, Change>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cost: Option<f64>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Correspondence {
pub fingerprint_version: String,
pub alignment: Alignment,
pub features: Vec<Entry<String>>,
pub new_features: Vec<String>,
pub faces: Vec<Entry<usize>>,
pub new_faces: Vec<usize>,
pub questions: Vec<String>,
}
pub fn correspond(old: &Fingerprints, new: &Fingerprints) -> Result<Correspondence, String> {
correspond_with(old, new, &Thresholds::default())
}
pub fn correspond_with(
old: &Fingerprints,
new: &Fingerprints,
th: &Thresholds,
) -> Result<Correspondence, String> {
let merged = |f: &Fingerprints| {
(f.fingerprint_version == FINGERPRINT_VERSION
&& f.features.iter().any(|feature| {
matches!(
feature.family.as_str(),
"oriented_slots" | "oriented_chamfers" | "oriented_slot_patterns"
)
}))
.then(|| {
let mut f = f.clone();
fingerprint::merge_legacy_families(&mut f);
f
})
};
let old_merged = merged(old);
let new_merged = merged(new);
let old = old_merged.as_ref().unwrap_or(old);
let new = new_merged.as_ref().unwrap_or(new);
for (which, f) in [("old", old), ("new", new)] {
validate(f).map_err(|e| format!("the {which} fingerprints {e}"))?;
}
let (motion, alignment) = align::align(old, new, th);
let ctx = Ctx {
old,
new,
th,
motion,
aligned: alignment.found,
axis: alignment.axis.map(|[p, d]| (p, d)),
scale: old.scale.max(new.scale),
};
let mut questions = Vec::new();
let (features, new_features) = ctx.match_features(&mut questions);
let (faces, new_faces) = ctx.match_faces(&features, &mut questions);
Ok(Correspondence {
fingerprint_version: FINGERPRINT_VERSION.into(),
alignment,
features,
new_features,
faces,
new_faces,
questions,
})
}
fn validate(f: &Fingerprints) -> Result<(), String> {
if f.fingerprint_version != FINGERPRINT_VERSION {
return Err(format!(
"are version {:?}, not {FINGERPRINT_VERSION:?}; fingerprints are not migrated \
between versions: re-fingerprint the part from its geometry with this quiddity",
f.fingerprint_version
));
}
if !(f.scale.is_finite() && f.scale > 0.0) {
return Err(format!(
"have scale {}, not a finite positive size",
f.scale
));
}
let n = f.faces.len();
for (i, face) in f.faces.iter().enumerate() {
if face.index != i {
return Err(format!("list face {} at position {i}", face.index));
}
if let Some((g, _)) = face.neighbours.iter().find(|(g, _)| *g >= n) {
return Err(format!("give face {i} neighbour {g}, beyond the {n} faces"));
}
}
for feature in &f.features {
if let Some(g) = feature.faces.iter().find(|&&g| g >= n) {
return Err(format!(
"give feature {} face {g}, beyond the {n} faces",
feature.id
));
}
}
Ok(())
}
pub(crate) fn same_value(a: f64, b: f64, rel: f64) -> bool {
(a - b).abs() <= rel * a.abs().max(b.abs()).max(1e-3)
}
pub(crate) fn multiset_distance(a: &[String], b: &[String]) -> f64 {
if a.is_empty() && b.is_empty() {
return 0.0;
}
let (mut i, mut j, mut common) = (0, 0, 0);
while i < a.len() && j < b.len() {
match a[i].cmp(&b[j]) {
std::cmp::Ordering::Equal => {
common += 1;
i += 1;
j += 1;
}
std::cmp::Ordering::Less => i += 1,
std::cmp::Ordering::Greater => j += 1,
}
}
1.0 - 2.0 * common as f64 / (a.len() + b.len()) as f64
}
fn multiset_changes(a: &[String], b: &[String]) -> (Vec<String>, Vec<String>) {
let (mut removed, mut added) = (Vec::new(), Vec::new());
let (mut i, mut j) = (0, 0);
while i < a.len() || j < b.len() {
match (a.get(i), b.get(j)) {
(Some(x), Some(y)) if x == y => {
i += 1;
j += 1;
}
(Some(x), Some(y)) if x < y => {
removed.push(x.clone());
i += 1;
}
(Some(x), None) => {
removed.push(x.clone());
i += 1;
}
(_, Some(y)) => {
added.push(y.clone());
j += 1;
}
(None, None) => break,
}
}
(removed, added)
}
fn sizes_distance(a: &BTreeMap<String, f64>, b: &BTreeMap<String, f64>) -> (f64, usize) {
let keys: BTreeSet<&String> = a.keys().chain(b.keys()).collect();
let mut sum = 0.0;
for k in &keys {
sum += match (a.get(*k), b.get(*k)) {
(Some(x), Some(y)) => {
let d = (x - y).abs() / x.abs().max(y.abs()).max(1e-9);
d.min(1.0)
}
_ => 1.0,
};
}
(sum, keys.len())
}
fn round(x: f64) -> f64 {
let r = (x * 1e6).round() / 1e6;
if r == 0.0 { 0.0 } else { r }
}
fn rounded(p: V3) -> Value {
json!(p.map(round))
}
struct Ctx<'a> {
old: &'a Fingerprints,
new: &'a Fingerprints,
th: &'a Thresholds,
motion: Motion,
aligned: bool,
axis: Option<(V3, V3)>,
scale: f64,
}
impl Ctx<'_> {
fn tol(&self) -> f64 {
self.th.position_tol * self.scale
}
fn gap(&self, p: V3, q: V3) -> f64 {
let p = self.motion.point(p);
match self.axis {
Some((o, d)) => {
let split = |x: V3| {
let v = geom::sub(x, o);
let along = geom::dot(v, d);
(along, geom::norm(geom::sub(v, geom::scale(d, along))))
};
let ((a1, r1), (a2, r2)) = (split(p), split(q));
(a1 - a2).hypot(r1 - r2)
}
None => geom::dist(p, q),
}
}
fn agreement(&self, x: V3, y: V3, line: bool) -> f64 {
let x = self.motion.dir(x);
let fold = |c: f64| if line { c.abs() } else { c };
match self.axis {
Some((_, d)) => {
let (a, b) = (fold(geom::dot(x, d)), fold(geom::dot(y, d)));
(a * b + ((1.0 - a * a).max(0.0) * (1.0 - b * b).max(0.0)).sqrt()).min(1.0)
}
None => fold(geom::dot(x, y)).min(1.0),
}
}
fn placement_weight(&self) -> f64 {
self.th.placement_weight
* if self.aligned {
1.0
} else {
self.th.unaligned_placement
}
}
fn displacement(&self, d: f64) -> f64 {
let reach = self.th.placement_reach * self.scale;
if self.aligned {
let tol = self.tol();
((1.0 + d / tol).ln() / (1.0 + reach / tol).ln()).min(1.0)
} else {
(d / reach).min(1.0)
}
}
fn placement(&self, a: (Option<V3>, Option<V3>), b: (Option<V3>, Option<V3>)) -> f64 {
let axis = match (a.0, b.0) {
(Some(x), Some(y)) => 1.0 - self.agreement(x, y, true),
(None, None) => 0.0,
_ => 1.0,
};
let position = match (a.1, b.1) {
(Some(p), Some(q)) => self.displacement(self.gap(p, q)),
_ => 0.5,
};
0.5 * axis + 0.5 * position
}
fn feature_cost(&self, a: &FeatureFingerprint, b: &FeatureFingerprint) -> f64 {
let trait_keys: BTreeSet<&String> = a.traits.keys().chain(b.traits.keys()).collect();
let differing = trait_keys
.iter()
.filter(|k| a.traits.get(**k) != b.traits.get(**k))
.count();
let (size_sum, size_n) = sizes_distance(&a.sizes, &b.sizes);
let traits = if trait_keys.is_empty() {
0.0
} else {
differing as f64 / trait_keys.len() as f64
};
let semantics = (traits + size_sum) / (1.0 + size_n as f64);
let neighbourhood = multiset_distance(&a.neighbourhood, &b.neighbourhood);
let placement = self.placement((a.axis, a.position), (b.axis, b.position));
self.th.semantics_weight * semantics
+ self.th.neighbourhood_weight * neighbourhood
+ self.placement_weight() * placement
}
fn feature_changes(
&self,
a: &FeatureFingerprint,
b: &FeatureFingerprint,
) -> BTreeMap<String, Change> {
let mut out = BTreeMap::new();
let keys: BTreeSet<&String> = a.traits.keys().chain(b.traits.keys()).collect();
for k in keys {
if a.traits.get(k) != b.traits.get(k) {
out.insert(
format!("traits.{k}"),
Change {
old: json!(a.traits.get(k)),
new: json!(b.traits.get(k)),
},
);
}
}
let keys: BTreeSet<&String> = a.sizes.keys().chain(b.sizes.keys()).collect();
for k in keys {
let (x, y) = (a.sizes.get(k), b.sizes.get(k));
let same = matches!((x, y), (Some(x), Some(y)) if same_value(*x, *y, self.th.same_rel));
if !same {
out.insert(
format!("sizes.{k}"),
Change {
old: json!(x),
new: json!(y),
},
);
}
}
if a.neighbourhood != b.neighbourhood {
let (removed, added) = multiset_changes(&a.neighbourhood, &b.neighbourhood);
out.insert(
"neighbourhood".into(),
Change {
old: json!(removed),
new: json!(added),
},
);
}
if self.aligned {
self.placement_changes(
&mut out,
(a.axis, a.position),
(b.axis, b.position),
true,
self.th.angle_tol,
);
}
out
}
fn placement_changes(
&self,
out: &mut BTreeMap<String, Change>,
a: (Option<V3>, Option<V3>),
b: (Option<V3>, Option<V3>),
line: bool,
angle_tol: f64,
) {
if let (Some(x), Some(y)) = (a.0, b.0)
&& self.agreement(x, y, line) < angle_tol.cos()
{
out.insert(
if line { "axis" } else { "normal" }.into(),
Change {
old: rounded(self.motion.dir(x)),
new: rounded(y),
},
);
}
if let (Some(p), Some(q)) = (a.1, b.1)
&& self.gap(p, q) > self.tol()
{
out.insert(
"position".into(),
Change {
old: rounded(self.motion.point(p)),
new: rounded(q),
},
);
}
}
fn match_features(&self, questions: &mut Vec<String>) -> (Vec<Entry<String>>, Vec<String>) {
let families: BTreeSet<&String> = self
.old
.features
.iter()
.chain(&self.new.features)
.map(|f| &f.family)
.collect();
let mut entries: Vec<Option<Entry<String>>> = vec![None; self.old.features.len()];
let mut taken = vec![false; self.new.features.len()];
for family in families {
let olds: Vec<usize> = (0..self.old.features.len())
.filter(|&i| &self.old.features[i].family == family)
.collect();
let news: Vec<usize> = (0..self.new.features.len())
.filter(|&j| &self.new.features[j].family == family)
.collect();
let costs: Vec<Vec<f64>> = olds
.iter()
.map(|&i| {
news.iter()
.map(|&j| self.feature_cost(&self.old.features[i], &self.new.features[j]))
.collect()
})
.collect();
let ids = |js: &[usize]| -> Vec<String> {
js.iter()
.map(|&j| self.new.features[news[j]].id.clone())
.collect()
};
for (r, outcome) in self.resolve(&costs, news.len()).into_iter().enumerate() {
let a = &self.old.features[olds[r]];
let entry = match outcome {
Outcome::Matched(j, cost) => {
taken[news[j]] = true;
let b = &self.new.features[news[j]];
let changes = self.feature_changes(a, b);
Entry {
old: a.id.clone(),
class: if changes.is_empty() {
Class::Carried
} else {
Class::Adapted
},
new: Some(b.id.clone()),
candidates: Vec::new(),
changes,
cost: Some(round(cost)),
}
}
Outcome::Ambiguous(js) => {
for &j in &js {
taken[news[j]] = true;
}
let candidates = ids(&js);
questions.push(format!(
"Which of {} is the old {}? They are alike within the margin (a pattern's instances or symmetric features).",
candidates.join(", "),
a.id
));
Entry {
old: a.id.clone(),
class: Class::Ambiguous,
new: None,
candidates,
changes: BTreeMap::new(),
cost: None,
}
}
Outcome::Unmatched => Entry {
old: a.id.clone(),
class: Class::Orphaned,
new: None,
candidates: Vec::new(),
changes: BTreeMap::new(),
cost: None,
},
};
entries[olds[r]] = Some(entry);
}
}
let new_features = (0..self.new.features.len())
.filter(|&j| !taken[j])
.map(|j| self.new.features[j].id.clone())
.collect();
(
entries.into_iter().map(Option::unwrap).collect(),
new_features,
)
}
fn resolve(&self, costs: &[Vec<f64>], m: usize) -> Vec<Outcome> {
let unmatched = 0.5 * self.th.cutoff;
let margin = self.th.margin;
let solution = assign::solve(costs, m, unmatched);
let mut budget = self.th.resolves;
let mut spend = || {
if budget == 0 {
return false;
}
budget -= 1;
true
};
let mut out = Vec::new();
for (i, row) in costs.iter().enumerate() {
let current = solution.matched[i];
let mut candidates = Vec::new();
let mut unsettled = false;
for j in 0..m {
if Some(j) == current || solution.reduced(i, Some(j)) >= margin {
continue;
}
if !spend() {
unsettled = true;
candidates.push(j);
continue;
}
if assign::force(costs, m, unmatched, i, j) < margin {
candidates.push(j);
}
}
let mut weak = false;
if current.is_some() && solution.reduced(i, None) < margin {
if !spend() {
unsettled = true;
} else if assign::force_unmatched(costs, m, unmatched, i) < margin {
weak = true;
}
}
out.push(match current {
Some(j) if candidates.is_empty() && !weak && !unsettled => {
Outcome::Matched(j, row[j])
}
None if candidates.is_empty() && !unsettled => Outcome::Unmatched,
_ => {
let mut all: Vec<usize> = current.into_iter().chain(candidates).collect();
all.sort_unstable();
Outcome::Ambiguous(all)
}
});
}
out
}
}
enum Outcome {
Matched(usize, f64),
Ambiguous(Vec<usize>),
Unmatched,
}
mod faces;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn correspond_refuses_fingerprints_that_do_not_hold_together() {
let path =
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/prismatic.step");
let good = recognise(&crate::read_step_file(&path).unwrap()).fingerprints;
assert!(!good.features.is_empty());
assert!(correspond(&good, &good).is_ok());
type Mutation = fn(&mut Fingerprints);
let bad: [(&str, Mutation); 8] = [
("face 999, beyond", |f| f.features[0].faces = vec![999]),
("neighbour 999", |f| {
f.faces[0].neighbours.push((999, "convex".into()))
}),
("at position 1", |f| f.faces[1].index = 0),
("scale 0", |f| f.scale = 0.0),
("scale NaN", |f| f.scale = f64::NAN),
("version", |f| f.fingerprint_version = "other".into()),
("fingerprint/2", |f| {
f.fingerprint_version = "quiddity-rust/fingerprint/2".into()
}),
("re-fingerprint the part", |f| {
f.fingerprint_version = "quiddity-rust/fingerprint/3".into()
}),
];
for (expected, mutate) in bad {
let mut f = good.clone();
mutate(&mut f);
let f = serde_json::from_str(&serde_json::to_string(&f).unwrap()).unwrap_or(f);
for (old, new) in [(&f, &good), (&good, &f)] {
let error = correspond(old, new).unwrap_err();
assert!(error.contains(expected), "{expected}: {error}");
}
}
}
}
#[cfg(test)]
mod normalisation_tests {
use super::*;
#[test]
fn invalid_normalisation_refuses_without_caller_space_records() {
let part = crate::read_step(include_bytes!(
"../../tests/fixtures/large_block_small_fillets.step"
))
.unwrap();
let frame = PartFrame {
origin: [0.; 3],
x: [1., 0., 0.],
y: [2e-12, 1., 0.],
z: [0., 0., 1.],
gauge: frames::FrameGauge::Full,
};
let result = recognise_in_frame(&part, frame);
assert_eq!(
result.frame,
RecordFrame::Refused {
reason: frames::FrameRefusal::NonrigidFrame
}
);
let mut expected = serde_json::to_value(Features::default()).unwrap();
for family in [
"oriented_slots",
"oriented_chamfers",
"oriented_slot_patterns",
] {
expected.as_object_mut().unwrap().remove(family);
}
assert_eq!(serde_json::to_value(&result.features).unwrap(), expected);
assert!(result.fingerprints.features.is_empty());
}
}