Motion analysis: scripting handles, depth wording, one hit per member pair a sample
This commit is contained in:
1 parent
8fdf6a61a2
commit
f5871608f4
5 files changed
+27
-12
No files matched your search
@@ -228,10 +228,11 @@ impl ContactGeometry {
|
||||
Ok(self.hits(s, work, MAX_WORK, false)?.into_iter().next().map(|(a, b, depth)| (a.1, b.1, depth)))
|
||||
}
|
||||
|
||||
/// The pairs that pass through each other in `s`, with how deep (every pair, or the first
|
||||
/// found when `all` is false). `work` adds up the cost, refused past `budget`.
|
||||
/// The pairs of set members whose bodies pass through each other in `s`, with how deep the
|
||||
/// first two bodies found go (every pair, or the first found when `all` is false). `work`
|
||||
/// adds up the cost, refused past `budget`.
|
||||
pub(super) fn hits(&self, s: &Session, work: &mut usize, budget: usize, all: bool) -> Result<Vec<(Member, Member, f64)>> {
|
||||
let mut out = Vec::new();
|
||||
let mut out: Vec<(Member, Member, f64)> = Vec::new();
|
||||
let meshes: Vec<Mesh> = self
|
||||
.bodies
|
||||
.iter()
|
||||
@@ -242,6 +243,10 @@ impl ContactGeometry {
|
||||
})
|
||||
.collect::<Result<_>>()?;
|
||||
for (a, b, oa, ob) in &self.pairs {
|
||||
// Members already found colliding need no more of their bodies tested.
|
||||
if out.iter().any(|(x, y, _)| (x.0, y.0) == (oa.0, ob.0) || (x.0, y.0) == (ob.0, oa.0)) {
|
||||
continue;
|
||||
}
|
||||
let (Some(ma), Some(mb), Some(ba), Some(bb)) = (meshes.get(*a), meshes.get(*b), self.bodies.get(*a), self.bodies.get(*b)) else {
|
||||
return Err(limit("invalid contact geometry pair"));
|
||||
};
|
||||
|
||||
@@ -31,7 +31,8 @@ pub const INTERFERENCE_DOC: &str = "study: id|name; occurrences?: [ids or names]
|
||||
default every occurrence), with against?: [ids or names] (then each of `occurrences` is checked only against these, such \
|
||||
as an arm against the parts it must miss), or contact_sets?: true (the pairs of the design's contact sets); samples? \
|
||||
(2…1000, default the study's steps + 1) → collisions: [{a, b, first_step, last_step, steps: [[from, to]…] (the step ranges where they overlap), \
|
||||
depth_mm (the deepest), deepest_step, volume_mm3 (their overlap there; null when it could not be worked out)}], clear, \
|
||||
depth_mm (how far into each other, the most at deepest_step), volume_mm3 (their overlap there; null when it was not \
|
||||
cheap to work out)}], clear, \
|
||||
pairs (checked), samples (taken), truncated (the work budget ran out; checked_to: the last step checked), stopped_at, \
|
||||
stopped_by_loop. The study plays as motion.play plays it but contact sets do not stop it, on a copy (the design is not \
|
||||
changed). Parts are tested at the samples only: one that passes wholly through another between two samples is missed";
|
||||
|
||||
Reference in new issue
Block a user