mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 18:45:55 +00:00
kernel: dead code the ports left is gone; core files formatted
(sheets agent's f57070d7 merged before this)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
@@ -142,7 +142,6 @@ fn placed_mesh(m: &Mesh, t: &[[f64; 4]; 4]) -> Option<Mesh> {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum FaceSource {
|
||||
ExtrudeSide {
|
||||
@@ -249,7 +248,6 @@ pub struct FaceInfo {
|
||||
pub plane_normal: Option<Vec3>,
|
||||
}
|
||||
|
||||
|
||||
/// The most one facet of the display mesh turns (radians): a curved face or edge is divided
|
||||
/// until no facet spans more of it than this, however small its radius is beside the body.
|
||||
/// 20 degrees: a quarter turn is drawn with at least five facets, a full circle with at least 18.
|
||||
@@ -1216,9 +1214,10 @@ impl Body {
|
||||
.into_iter()
|
||||
.map(|r| {
|
||||
let part = self.record.part(&[r]).map_err(|e| KernelError::Failed(format!("lump: {e}")))?;
|
||||
let sources = self.face_sources.as_ref().map(|all| {
|
||||
std::sync::Arc::new(part.faces.iter().map(|&f| all.get(f as usize).cloned().flatten()).collect::<Vec<_>>())
|
||||
});
|
||||
let sources = self
|
||||
.face_sources
|
||||
.as_ref()
|
||||
.map(|all| std::sync::Arc::new(part.faces.iter().map(|&f| all.get(f as usize).cloned().flatten()).collect::<Vec<_>>()));
|
||||
let history = crate::history::of_part(&part, &counts);
|
||||
let piece = Body::from_record(part.brep)?.with_face_sources(sources).inherit_regularization_protection(self);
|
||||
Ok(piece.with_checked_history(Some(history), &counts))
|
||||
|
||||
@@ -257,7 +257,10 @@ fn an_arc_the_chord_tolerance_already_divides_finely_is_left_alone() {
|
||||
// And a body with nothing curved at any tolerance.
|
||||
let b = crate::box_solid(Vec3::ZERO, Vec3::new(3000.0, 1000.0, 2.0)).unwrap();
|
||||
let tol = display_tol(&b);
|
||||
assert_eq!(b.mesh(&crate::MeshTolerance { chord: tol, angle: Some(DISPLAY_ANGLE) }).unwrap().positions, b.mesh(&crate::MeshTolerance::chord(tol)).unwrap().positions);
|
||||
assert_eq!(
|
||||
b.mesh(&crate::MeshTolerance { chord: tol, angle: Some(DISPLAY_ANGLE) }).unwrap().positions,
|
||||
b.mesh(&crate::MeshTolerance::chord(tol)).unwrap().positions
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -118,13 +118,7 @@ pub fn boolean_shapes(seed: u64) -> (Shape, Shape) {
|
||||
/// V(A∪B) + V(A∩B) = V(A) + V(B) and V(A−B) = V(A) − V(A∩B), within 0.2 %.
|
||||
pub fn boolean_case(seed: u64) -> BoolCase {
|
||||
let (a, b) = boolean_shapes(seed);
|
||||
let mut case = BoolCase {
|
||||
seed,
|
||||
a: a.clone(),
|
||||
b: b.clone(),
|
||||
outcome: "ok".into(),
|
||||
detail: String::new(),
|
||||
};
|
||||
let mut case = BoolCase { seed, a: a.clone(), b: b.clone(), outcome: "ok".into(), detail: String::new() };
|
||||
let fail = |c: &mut BoolCase, kind: &str, d: String| {
|
||||
c.outcome = kind.into();
|
||||
c.detail = d;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
pub use solidcraft_geom::brep::history::{Change, EdgeOrigin, EdgeProv, FaceOrigin, FaceProv, History, Side};
|
||||
|
||||
use crate::body::{Body, FaceSource};
|
||||
use solidcraft_geom::brep::{Brep, part::Part};
|
||||
use crate::{KernelError, Result};
|
||||
use solidcraft_geom::brep::{Brep, part::Part};
|
||||
|
||||
impl From<solidcraft_geom::brep::history::Failed> for KernelError {
|
||||
fn from(e: solidcraft_geom::brep::history::Failed) -> KernelError {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
//! ([`FaceOrigin::Offset`]), and its edges as where its faces meet. A face SMLib makes new along
|
||||
//! a sheet's open edge (a thickened sheet's wall) is recorded as made in place of that edge.
|
||||
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use solidcraft_geom::Vec3;
|
||||
|
||||
@@ -101,10 +101,8 @@ fn joined(bodies: &[Body]) -> Result<(Body, part::Part)> {
|
||||
let records: Vec<&solidcraft_geom::brep::Brep> = bodies.iter().map(Body::record).collect();
|
||||
let part = part::compound(&records).map_err(|e| KernelError::Failed(format!("pieces: {e}")))?;
|
||||
// Each face's source, numbered as `compound` numbers the inputs: one after another.
|
||||
let sources: Vec<Option<crate::FaceSource>> = bodies
|
||||
.iter()
|
||||
.flat_map(|b| (0..b.face_count()).map(move |f| b.face_sources().and_then(|s| s.get(f)).cloned().flatten()))
|
||||
.collect();
|
||||
let sources: Vec<Option<crate::FaceSource>> =
|
||||
bodies.iter().flat_map(|b| (0..b.face_count()).map(move |f| b.face_sources().and_then(|s| s.get(f)).cloned().flatten())).collect();
|
||||
let mapped = bodies
|
||||
.iter()
|
||||
.any(|b| b.face_sources().is_some())
|
||||
|
||||
@@ -106,4 +106,3 @@ pub(super) fn meshes_meet(a: &Mesh, b: &Mesh, gap: f64) -> Result<bool> {
|
||||
// No boundary contact: they meet only if one lies wholly inside the other.
|
||||
Ok(b.positions.first().is_some_and(|p| a.contains(*p)) || a.positions.first().is_some_and(|p| b.contains(*p)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user