Thought about it for 2 minutes and found an ok solution : very close to something working for this 2nd strategy that feels a lot better

This commit is contained in:
Jean-Gabriel Gill-Couture 2023-07-23 23:55:04 -04:00
parent 4ef577e76b
commit 93781cae4a

View File

@ -132,13 +132,19 @@ impl SpaceColonization {
}
}
if let Some(node) = closest_node {
let attractors = match growing_paths.get_mut(node) {
Some(a) => a.take(),
None => Vec::new(),
};
if let Some(attractors) = growing_paths.get_mut(node) {
attractors.push(a);
} else {
let mut attractors = Vec::new();
attractors.push(a);
growing_paths.insert(node, attractors);
}
}
}
console::log_1(&format!("found {} pairs ", growing_paths.len()).into());
console::log_1(&format!("found {:?} pairs ", growing_paths).into());
for node in growing_paths {
todo!("calculate new node position averaging all attractors");
}
}
}