mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 10:35:58 +00:00
After the merge: a hole that misses is found by exact boxes; a face is a one-face patch; main's mesh-box helpers gone
- `hole_misses` (main's #10701, through brett's branch) decided from the targets' mesh boxes. It now uses their exact boxes (`Body::exact_bounds`). An unknown box still leaves the hole not known to miss. - With #10303's two shortcuts and `hole_misses` off the mesh, `body_box`, `mesh_box` and `padded_box` have no caller left, and are deleted. - `project`'s intersection link passes its one face to `meeting_edges` as a one-element patch. This branch picks one face, not #9009's mesh patch. - xtask/mesh-decisions.txt drops the six sites that no longer use a mesh here: `apply_traced_with`, `cut_end_past_face`, `beyond_cylinder_reach`, `hole_misses`, `body_box`/`mesh_box`/`padded_box`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
@@ -6005,10 +6005,10 @@ fn hole_targets<'a>(st: &'a ModelState, f: &Feature) -> Vec<&'a ModelBody> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether hole tool `tool` is clear of every body the hole cuts, by their boxes (#10701). Boxes
|
||||
/// only: a probe boolean for every hole of a large hole pattern would double its work, and the
|
||||
/// bodies' meshes are there already (the hole found its face on them). A body of another
|
||||
/// component is in another frame: the hole is then not known to miss.
|
||||
/// Whether hole tool `tool` is clear of every body the hole cuts, by their exact boxes (#10701).
|
||||
/// Boxes only: a probe boolean for every hole of a large hole pattern would double its work. A
|
||||
/// body whose exact box is unknown, or one of another component (in another frame), leaves the
|
||||
/// hole not known to miss.
|
||||
fn hole_misses(st: &ModelState, f: &Feature, tool: &Body) -> bool {
|
||||
let targets = hole_targets(st, f);
|
||||
let bounds = tool.outline_bounds();
|
||||
@@ -6021,7 +6021,7 @@ fn hole_misses(st: &ModelState, f: &Feature, tool: &Body) -> bool {
|
||||
return false;
|
||||
}
|
||||
let tool_box = Some(bounds.inflated(1e-6));
|
||||
targets.iter().all(|b| more::boxes_apart(&tool_box, &more::mesh_box(b)))
|
||||
targets.iter().all(|b| more::boxes_apart(&tool_box, &b.body.exact_bounds().ok()))
|
||||
}
|
||||
|
||||
fn copy_misses(st: &ModelState, f: &Feature, targets: &[String], tools: &[Traced]) -> bool {
|
||||
|
||||
@@ -1585,25 +1585,8 @@ fn sheet_prism_cut(
|
||||
Ok(handled)
|
||||
}
|
||||
|
||||
/// A box around `body`, grown past its mesh's deflection from the exact faces (and a hair
|
||||
/// more): bodies whose boxes are apart do not meet. None when it can't be worked out.
|
||||
fn body_box(body: &Body) -> Option<Aabb3> {
|
||||
let tol = (body.size() * 1e-3).max(1e-4);
|
||||
padded_box(&body.mesh(&solidcraft_kernel::MeshTolerance::chord(tol)).ok()?, tol)
|
||||
}
|
||||
|
||||
/// [`body_box`] of a model body, from the mesh it keeps.
|
||||
fn mesh_box(mb: &ModelBody) -> Option<Aabb3> {
|
||||
padded_box(&mb.mesh(), mb.display_tol())
|
||||
}
|
||||
|
||||
fn padded_box(mesh: &solidcraft_geom::Mesh, tol: f64) -> Option<Aabb3> {
|
||||
let b = mesh.bounds();
|
||||
(!b.is_empty() && b.min.is_finite() && b.max.is_finite()).then(|| b.inflated(2.0 * tol + 1e-6))
|
||||
}
|
||||
|
||||
/// Whether two boxes are known to be apart (an unknown box is never apart).
|
||||
fn boxes_apart(a: &Option<Aabb3>, b: &Option<Aabb3>) -> bool {
|
||||
pub(super) fn boxes_apart(a: &Option<Aabb3>, b: &Option<Aabb3>) -> bool {
|
||||
let (Some(a), Some(b)) = (a, b) else { return false };
|
||||
a.max.x < b.min.x || b.max.x < a.min.x || a.max.y < b.min.y || b.max.y < a.min.y || a.max.z < b.min.z || b.max.z < a.min.z
|
||||
}
|
||||
|
||||
@@ -228,7 +228,9 @@ fn resolve_uncached(
|
||||
let (ba, fa) = crate::project3d::part_of(st, a).ok_or_else(|| lost(&a.describe()))?;
|
||||
let (bb, fb) = crate::project3d::part_of(st, b).ok_or_else(|| lost(&b.describe()))?;
|
||||
let chord = (ba.body.size().max(bb.body.size()) * 1e-3).max(1e-3);
|
||||
for e in crate::kernel::meeting_edges(&ba.body, fa.as_deref(), &bb.body, fb.as_deref(), chord)? {
|
||||
for e in
|
||||
crate::kernel::meeting_edges(&ba.body, fa.as_ref().map(std::slice::from_ref), &bb.body, fb.as_ref().map(std::slice::from_ref), chord)?
|
||||
{
|
||||
wires.push(e.points);
|
||||
exact.push(vec![WireCurve { curve: e.curve, interval: e.interval }]);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,8 @@ crates/doc/src/config_styles.rs:Document::configuration_face_indices checks a co
|
||||
crates/doc/src/construct.rs:GeoRef::name_picks names picked faces and edges through the display mesh
|
||||
crates/doc/src/construct.rs:named_vertex finds where named edges meet through the display mesh
|
||||
crates/doc/src/document.rs:MeshData::eq compares imported mesh payloads by their triangles
|
||||
crates/doc/src/eval.rs:apply_traced_with passes over targets clear of a cut by mesh boxes
|
||||
crates/doc/src/eval.rs:blend_edges_on finds a blend's edges on the display mesh
|
||||
crates/doc/src/eval.rs:body_at picks the body whose surface is nearest a point by the display mesh
|
||||
crates/doc/src/eval.rs:cut_end_past_face finds the gap past a face a cut ends in by the display mesh
|
||||
crates/doc/src/eval.rs:edge_refs turns edge picks into references through the display mesh
|
||||
crates/doc/src/eval.rs:eval_feature places features by the display mesh (faces, edges, nearness)
|
||||
crates/doc/src/eval.rs:face_plane finds a sketch's face plane again on a mesh
|
||||
@@ -22,7 +20,6 @@ crates/doc/src/eval.rs:feature_tools_with_constructor reaches a To Object extent
|
||||
crates/doc/src/eval.rs:height_at measures a point's height on a face by the display mesh
|
||||
crates/doc/src/eval.rs:hole_axis_size sizes a hole's tools by the bodies its axis meets on the display mesh
|
||||
crates/doc/src/eval.rs:hole_depth_to works out a hole's To Object depth on the display mesh
|
||||
crates/doc/src/eval.rs:hole_misses decides a hole misses bodies by their mesh boxes
|
||||
crates/doc/src/eval.rs:hole_on_surface moves a hole back onto its face by the display mesh
|
||||
crates/doc/src/eval.rs:hole_reaches decides whether a drill reaches material by the display mesh
|
||||
crates/doc/src/eval.rs:nearest_object_face picks an extrusion's To Object face by the display mesh
|
||||
@@ -35,10 +32,7 @@ crates/doc/src/eval.rs:trim_to_body keeps the tool pieces touching the start by
|
||||
crates/doc/src/eval.rs:unrecorded_touches finds touching pieces by a mesh
|
||||
crates/doc/src/eval_more.rs:FaceSlice::outline finds the wall an outline runs along by mesh triangles
|
||||
crates/doc/src/eval_more.rs:FaceSlice::recesses finds a plate's recesses by mesh triangles
|
||||
crates/doc/src/eval_more.rs:beyond_cylinder_reach skips bodies far from a tap marking by their mesh boxes
|
||||
crates/doc/src/eval_more.rs:body_box boxes a body by a mesh of it
|
||||
crates/doc/src/eval_more.rs:body_under picks the body under a plastic feature's point by the display mesh
|
||||
crates/doc/src/eval_more.rs:mesh_box boxes a model body by its display mesh
|
||||
crates/doc/src/eval_more.rs:on_sheet_material decides whether a point touches a sheet by the display mesh
|
||||
crates/doc/src/eval_more.rs:planar_normal_at finds the planar face through a point by a mesh
|
||||
crates/doc/src/eval_more.rs:plastic_eval places plastic features by a mesh
|
||||
|
||||
Reference in New Issue
Block a user