perf: AABB snap pre-rejection via acadrust bounding_box() (Option K upgrade)
Add `aabb: [f32; 4]` field to WireModel (world-space 2-D bounding box). In tessellate_entity() set each wire's AABB from e.as_entity().bounding_box() via new entity_aabb() helper; Insert sub-entities each get their own AABB. Preview/interim wires and any entity returning a zero-extent default box get UNBOUNDED_AABB so they are never pre-rejected. Replace the chord-sphere heuristic in Snapper::wire_in_range() with a proper AABB vs snap-circle overlap test. The new check is four scalar comparisons and correctly handles closed curves (circles, arcs) which the chord-sphere approach had to special-case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2da9301a2b
commit
bfd8d0411a
35 changed files with 107 additions and 25 deletions
|
|
@ -96,6 +96,7 @@ pub fn tessellate(
|
|||
tangent_geoms: te.tangent_geoms,
|
||||
aci: 0,
|
||||
key_vertices: te.key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -122,6 +123,7 @@ pub fn tessellate(
|
|||
tangent_geoms: te.tangent_geoms,
|
||||
aci: 0,
|
||||
key_vertices: te.key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
};
|
||||
}
|
||||
_ => {}
|
||||
|
|
@ -142,6 +144,7 @@ pub fn tessellate(
|
|||
tangent_geoms: te.tangent_geoms,
|
||||
aci: 0,
|
||||
key_vertices: te.key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -160,6 +163,7 @@ pub fn tessellate(
|
|||
tangent_geoms: te.tangent_geoms,
|
||||
aci: 0,
|
||||
key_vertices: te.key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -177,6 +181,7 @@ pub fn tessellate(
|
|||
tangent_geoms: te.tangent_geoms,
|
||||
aci: 0,
|
||||
key_vertices: te.key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -205,6 +210,7 @@ pub fn tessellate(
|
|||
snap_pts,
|
||||
tangent_geoms,
|
||||
key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,6 +247,7 @@ pub fn tessellate_dimension(
|
|||
snap_pts: vec![],
|
||||
tangent_geoms: vec![],
|
||||
key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}];
|
||||
|
||||
if let Some(text) = dimension_text_entity(dim) {
|
||||
|
|
@ -287,6 +294,7 @@ fn tessellate_leader(
|
|||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
@ -354,6 +362,7 @@ fn tessellate_leader(
|
|||
snap_pts: vec![],
|
||||
tangent_geoms: vec![],
|
||||
key_vertices,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}]
|
||||
}
|
||||
|
||||
|
|
@ -460,6 +469,7 @@ fn tessellate_multileader(
|
|||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: key_verts,
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}];
|
||||
|
||||
// Render text content as MText wire
|
||||
|
|
|
|||
Loading…
Reference in a new issue