forked from 1b-agent/opencadstudio-upstream
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:
1 parent
2da9301a2b
commit
bfd8d0411a
35 files changed
+107
-25
No files matched your search
@@ -101,6 +101,7 @@ impl CadCommand for AlignedDimensionCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -134,5 +135,6 @@ fn preview_aligned(p1: Vec3, p2: Vec3, dim_pt: Vec3) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
@@ -124,6 +124,7 @@ fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,5 +100,6 @@ fn preview_line(a: Vec3, b: Vec3) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
@@ -142,6 +142,7 @@ impl CadCommand for DimBaselineCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ impl CadCommand for DimContinueCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ impl CadCommand for DimJogLineCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,7 @@ impl CadCommand for DimTeditCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +154,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +365,7 @@ fn preview_wire(pts: &[Vec3]) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ impl CadCommand for QdimCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,5 +111,6 @@ fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
}
|
||||
}
|
||||
@@ -144,6 +144,7 @@ impl CadCommand for TableCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -97,6 +97,7 @@ impl CadCommand for ToleranceCommand {
|
||||
tangent_geoms: vec![],
|
||||
aci: 0,
|
||||
key_vertices: vec![],
|
||||
aabb: WireModel::UNBOUNDED_AABB,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user