Layer split stage 1: the B-rep record, native body file and Vec/Plane come from solidcore-record (#11496)

* Kernel: the B-rep record and the native body file come from solidcore-record

SolidCraft's portable B-rep record (`solidcraft_geom::brep`: brep.rs, topology, history,
envelope, part, curve2) and the native body file (`solidcraft_kernel::native`: the tagged binary
codec and the container) move to solidcore's `solidcore-record` crate: geometry as data, with
structural validation and no maths (solidcore's docs/layers.md, stage 1). Every caller uses
`solidcore_record::brep` and `solidcore_record::native`; the old copies are deleted.

What computes from coordinates stays with the kernel, in geom's `brep`:
- `brep::check`: the record's geometric checks (orthonormal frames, non-degenerate planes,
  unit revolution axes, non-singular placements). `check::validate` and
  `check::validate_built` are the record's validation and these together, and every caller of
  `Brep::validate` uses them, so what is accepted is unchanged;
- `brep::label`: a surface's natural ranges (a cone's apex), `curve_interval`,
  `edge_curve_interval` and `form_turns`;
- `brep::pcurve::eval`: a pcurve's point;
- `geometry::check`, `placement::moved` and `split_edges` become functions on the record.

The kernel's native module keeps the conversion between a body and its saved record
(metadata.rs) and checks the decoded record's geometry. `native/analytic.rs`, which no module
declared, is deleted.

solidcore-record is pinned to its rev on solidcore's `layer-record` branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvoxKMbMFSQU8tzRtoJhtT

* Geometry: Vec2, Vec3, Plane and the profile types come from solidcore-record

The plain data of vectors and points, sketch planes and planar profiles (`Seg2`, `Loop2`,
`Region2`) moves to `solidcore-record`, with its constants and component-wise operators only
(owner decision, solidcore layer split). Their geometry stays in geom as traits:
`Vec2Geom`, `Vec3Geom`, `PlaneGeom`, `Seg2Geom`, `Loop2Geom`, `Region2Geom`, `Seg2ArcFit`,
`Loop2ArcFit` and `Region2ArcFit`, in scope with `use solidcraft_geom::prelude::*`. Every caller
names the types from `solidcore_record`; geom no longer defines or re-exports them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvoxKMbMFSQU8tzRtoJhtT

* Kernel: pin solidcore-record to solidcore main f5e8e9a29

solidcore-record is merged on solidcore main (tangency-labs/solidcore#2519); its crate there is
identical to the rev pinned before but for its clippy configuration. The lock is regenerated
against the merged rev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvoxKMbMFSQU8tzRtoJhtT

---------

Co-authored-by: jyviko <2501648+jyviko@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-11-03 09:04:26 -05:00
committed by GitHub
parent bd2dc3fade
commit dc38349cbf
806 changed files with 4281 additions and 6434 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
//! Surface analysis as a view draws it: the shading mode and the colours it uses.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
/// Surface analysis colours, straight sRGB 0..1 as the shader takes them.
#[derive(Clone, Copy, Debug, PartialEq)]
+2 -1
View File
@@ -15,9 +15,10 @@
//! Consumers retain geometric normals for ray spawning and optical boundaries.
//! No shading-normal energy correction, multiple scattering or transmission is modeled.
use solidcraft_geom::prelude::*;
use std::f64::consts::{PI, TAU};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use crate::surface::{MIN_ROUGHNESS, OpaqueSurface, SurfaceError, unit_direction};
+3 -1
View File
@@ -1,5 +1,7 @@
use serde::{Deserialize, Serialize};
use solidcraft_geom::{Aabb3, Vec3};
use solidcore_record::Vec3;
use solidcraft_geom::Aabb3;
use solidcraft_geom::prelude::*;
/// Column-major 4×4 matrix.
#[derive(Clone, Copy, Debug, PartialEq)]
+2 -1
View File
@@ -3,7 +3,8 @@
//! and refraction of substrate directions are omitted. This is a bounded preview
//! model, not a full layered random walk. See docs/render-clear-coat.md.
use crate::surface::{MIN_ROUGHNESS, OpaqueSurface, SurfaceError, unit_direction};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use std::f64::consts::PI;
#[derive(Clone, Copy, Debug, PartialEq)]
+4 -3
View File
@@ -1,6 +1,7 @@
//! Pixel-bounded display paths. CAD segments remain untouched; positive homogeneous
//! control hulls bound perspective projection, including looping and rational curves.
use solidcraft_geom::{Plane, Seg2, Vec2, Vec3};
use solidcore_record::{Plane, Seg2, Vec2, Vec3};
use solidcraft_geom::prelude::*;
use crate::Mat4;
@@ -57,7 +58,7 @@ fn mix(a: H, b: H, t: f64) -> H {
}
/// The most control points of one span: a Bézier of the highest degree.
const MAX_CONTROLS: usize = solidcraft_geom::MAX_BEZIER_DEGREE + 1;
const MAX_CONTROLS: usize = solidcore_record::MAX_BEZIER_DEGREE + 1;
/// One span's homogeneous control points, kept inline: the sampler splits and projects
/// thousands of them per curve and view, and a `Vec` each was most of its allocations.
@@ -141,7 +142,7 @@ fn controls(segment: &Seg2, plane: &Plane) -> Option<(Vec<Hull>, H)> {
Seg2::Line { a, b } => vec![Hull::new(&[h(a, 1.0), h(b, 1.0)])?],
Seg2::Cubic { p0, p1, p2, p3 } => vec![Hull::new(&[h(p0, 1.0), h(p1, 1.0), h(p2, 1.0), h(p3, 1.0)])?],
Seg2::Conic { a, apex, b, w } if w > 0.0 => vec![Hull::new(&[h(a, 1.0), h(apex, w), h(b, 1.0)])?],
Seg2::Bezier { n, p } if (1..=solidcraft_geom::MAX_BEZIER_DEGREE as u8).contains(&n) => {
Seg2::Bezier { n, p } if (1..=solidcore_record::MAX_BEZIER_DEGREE as u8).contains(&n) => {
let mut hull = Hull { len: n as usize + 1, p: [[0.0; 4]; MAX_CONTROLS] };
for (out, p) in hull.p.iter_mut().zip(&p[..=n as usize]) {
*out = h(*p, 1.0);
+3 -3
View File
@@ -27,7 +27,7 @@ fn dense_error(s: &Seg2, plane: &Plane, v: &PixelCurveView, path: &SampledPath)
#[test]
fn exact_arcs_ellipses_rational_and_looping_control_hulls_bound_pixels() {
let mut degree7 = [Vec2::ZERO; solidcraft_geom::MAX_BEZIER_CTRL];
let mut degree7 = [Vec2::ZERO; solidcore_record::MAX_BEZIER_CTRL];
for (i, p) in degree7.iter_mut().enumerate() {
*p = Vec2::new(i as f64 / 4.0 - 0.875, if i % 2 == 0 { -0.8 } else { 0.8 });
}
@@ -139,7 +139,7 @@ fn reference_controls(segment: &Seg2, plane: &Plane) -> Option<(Vec<Vec<H>>, H)>
Seg2::Line { a, b } => vec![vec![h(a, 1.0), h(b, 1.0)]],
Seg2::Cubic { p0, p1, p2, p3 } => vec![vec![h(p0, 1.0), h(p1, 1.0), h(p2, 1.0), h(p3, 1.0)]],
Seg2::Conic { a, apex, b, w } if w > 0.0 => vec![vec![h(a, 1.0), h(apex, w), h(b, 1.0)]],
Seg2::Bezier { n, p } if (1..=solidcraft_geom::MAX_BEZIER_DEGREE as u8).contains(&n) => {
Seg2::Bezier { n, p } if (1..=solidcore_record::MAX_BEZIER_DEGREE as u8).contains(&n) => {
vec![p[..=n as usize].iter().map(|p| h(*p, 1.0)).collect()]
}
Seg2::Arc { center, radius, start, sweep }
@@ -323,7 +323,7 @@ fn same_path(a: &SampledPath, b: &SampledPath) -> bool {
/// unclipped, with ample and with nearly spent budgets.
#[test]
fn samples_the_same_points_bit_for_bit_as_the_reference() {
let mut degree9 = [Vec2::ZERO; solidcraft_geom::MAX_BEZIER_CTRL];
let mut degree9 = [Vec2::ZERO; solidcore_record::MAX_BEZIER_CTRL];
for (i, p) in degree9.iter_mut().enumerate().take(10) {
let t = i as f64 / 9.0;
*p = Vec2::new(t * 2.0 - 1.0, ((i % 3) as f64 - 1.0) * 0.8);
+2 -1
View File
@@ -9,7 +9,8 @@
use super::{CompletePass, MAX_BYTES, invalid, limit};
use crate::job::encoding::PngEncoding;
use crate::job::{CancelToken, CpuHost, ErrorCode, JobError, Phase, Progress, Reservation, Result};
use solidcraft_geom::{Vec3, srgb::encode8};
use solidcore_record::Vec3;
use solidcraft_geom::srgb::encode8;
/// Encoded bytes retain the actual existing host lease. No detached byte getter.
pub struct CompletedPng {
+2 -1
View File
@@ -5,9 +5,10 @@
//! the same from frame to frame and as the plane moves. Spacing and line width are the same for
//! every hatch; only the angle and the colour change.
use solidcraft_geom::prelude::*;
use std::collections::{HashMap, HashSet};
use solidcraft_geom::{Vec2, Vec3};
use solidcore_record::{Vec2, Vec3};
/// The colours a cut is hatched in: the section cap's own, then the others of its family.
pub const HATCH_COLOURS: usize = 3;
+3 -3
View File
@@ -1600,8 +1600,8 @@ mod retained_request_tests {
request.raytrace.as_mut().unwrap().emissions = Some(values);
let expected = retained_request_bytes(&request).unwrap();
let mesh = solidcraft_geom::Mesh {
positions: vec![solidcraft_geom::Vec3::ZERO, solidcraft_geom::Vec3::X, solidcraft_geom::Vec3::Y],
normals: vec![solidcraft_geom::Vec3::Z; 3],
positions: vec![solidcore_record::Vec3::ZERO, solidcore_record::Vec3::X, solidcore_record::Vec3::Y],
normals: vec![solidcore_record::Vec3::Z; 3],
triangles: vec![[0, 1, 2]],
tri_face: vec![0],
..Default::default()
@@ -1786,7 +1786,7 @@ mod surface_request_metadata_tests {
bump_amplitude_mm: 0.0,
});
}
let scene = ProductScene { meshes, bounds: Aabb3 { min: solidcraft_geom::Vec3::ZERO, max: solidcraft_geom::Vec3::ZERO } };
let scene = ProductScene { meshes, bounds: Aabb3 { min: solidcore_record::Vec3::ZERO, max: solidcore_record::Vec3::ZERO } };
let mut request = request();
request.integrator = Integrator::Raytrace;
request.raytrace = Some(super::super::RaytraceOptions { surface_effects: Some(effects), ..Default::default() });
+2 -1
View File
@@ -1,9 +1,10 @@
//! Incremental product rasterization. Every phase yields between bounded work units.
use solidcraft_geom::prelude::*;
use std::collections::BTreeMap;
use serde::Serialize;
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use super::{CancelToken, ErrorCode, ImageRequest, JobError, Phase, Progress, Result};
use crate::{FaceAppearance, Mat4, ProductScene, RenderFormat, RenderMode, RenderOperation, RenderRequest};
+2 -1
View File
@@ -2,7 +2,8 @@
//! No source mesh, visible emission, spectral/CCT calibration or separate transport.
use super::{ErrorCode, JobError, RaytraceOptions, RectangleLightOptions, Result};
use serde::{Deserialize, Serialize};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
/// Illustrative linear RGB choices, not measured LED spectra or calibrated CCT.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
+2 -1
View File
@@ -2,7 +2,8 @@
//! world-space millimetres; radiance is linear RGB. Saved setups reuse these bounds.
use super::{ErrorCode, JobError, Result};
use serde::{Deserialize, Serialize};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
pub const MAX_AREA_LIGHTS: usize = 4;
+2 -1
View File
@@ -1,6 +1,7 @@
//! Product-image work and its device-independent, session-scoped protocol.
//! Hosts own execution; documents and history never contain these values.
use solidcraft_geom::prelude::*;
use std::fmt;
use std::sync::{
Arc,
@@ -963,7 +964,7 @@ impl RaytraceOptions {
}
if let Some(lights) = &self.area_lights {
for light in lights {
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
let vec = |v: [f64; 3]| Vec3::new(v[0], v[1], v[2]);
let c = vec(light.center_mm);
let u = vec(light.edge_u_mm);
+1 -1
View File
@@ -60,7 +60,7 @@ impl PunctualLightOptions {
#[cfg(feature = "raytrace-cpu")]
pub(crate) fn light(self) -> crate::raytrace::Result<crate::raytrace::punctual::PunctualLight> {
use crate::raytrace::punctual::{PunctualLight, SpotCone};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
let [x, y, z] = self.position_mm;
let [r, g, b] = self.color;
let cone = self
+2 -1
View File
@@ -8,7 +8,8 @@ use crate::{
};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
pub const MAX_TEXTURE_BINDINGS: usize = 128;
pub const MAX_TEXTURE_PIXELS_BYTES: u64 = 96 * 1024 * 1024;
+1 -1
View File
@@ -4,7 +4,7 @@ use super::{HdrDecodeTask, HdrSource, HdrTaskPoll};
use crate::job::{CancelToken, ErrorCode, JobError, Result};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use std::{
f64::consts::{PI, TAU},
sync::Arc,
@@ -2,7 +2,8 @@
//! Uniform solid-angle sampling deliberately has no luminance CDF or extra pixel copy.
use super::{DecodedHdr, HdrError, HdrErrorCode, MAX_HDR_HEIGHT, MAX_HDR_PIXELS, MAX_HDR_WIDTH, Result};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use std::f64::consts::{PI, TAU};
fn invalid(message: &str) -> HdrError {
+3 -1
View File
@@ -1,7 +1,9 @@
//! Definition-local visual coordinates, independent of geometry and engineering axes.
//! This numerical foundation installs no texture sampler, shader or persistent record.
use solidcraft_geom::{Aabb3, Vec3};
use solidcore_record::Vec3;
use solidcraft_geom::Aabb3;
use solidcraft_geom::prelude::*;
/// Admission bounds, not a GPU precision or engineering applicability guarantee.
pub const MAX_LOCAL_MM: f64 = 1e9;
+2 -1
View File
@@ -1,7 +1,8 @@
//! CPU rasterizer for headless snapshots: z-buffered, smooth-shaded triangles and depth-tested
//! lines, rendered at 2× and downsampled for anti-aliasing.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use crate::Camera;
use crate::scene::{Rgb, SECTION_CAP, Scene, png};
@@ -2,7 +2,8 @@
//! Captured ordinal/name and mesh face tag must match. Strict plane equality is
//! conservative: rotated or imported roundoff may refuse instead of guessing.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use crate::{
ProductScene,
+2 -1
View File
@@ -2,7 +2,8 @@
//! Sampling estimates the area integral; it is not an exact solid-angle integral.
//! No emitter geometry, indirect bounce or calibrated photometric units are implied.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use super::lighting::MAX_LINEAR_RADIANCE;
use super::{MAX_COORDINATE_MM, MAX_DISTANCE_MM, Ray, Result, TraceError};
+2 -1
View File
@@ -2,7 +2,8 @@
//! Air is 1.0. Distances and absorption coefficients use millimetres.
use super::{Bounds, Result, TraceError, Triangle, unit};
use crate::{ProductScene, job::DielectricOptions};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
pub const MAX_OVERRIDES: usize = 8;
pub const MAX_BOUNDARIES: u8 = 8;
+1 -1
View File
@@ -1,6 +1,6 @@
//! Visible surface radiance only: no mesh-light sampling or neighboring illumination.
use crate::job::{EmissionSides, SurfaceEmission};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
#[derive(Clone, Copy, Debug)]
pub struct Emission {
+3 -1
View File
@@ -13,7 +13,9 @@ use crate::{
film::primary::PrimaryFilm,
surface::{OpaqueSurface, srgb8_to_linear},
};
use solidcraft_geom::{Vec3, srgb::encode8};
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use solidcraft_geom::srgb::encode8;
#[cfg(test)]
#[path = "environment_image_tests.rs"]
+2 -1
View File
@@ -2,7 +2,8 @@
//! Colours are linear sRGB; intensity is relative radiance, not watts or illuminance.
//! Visibility is supplied separately for every light by the ray-tracing consumer.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use crate::surface::{OpaqueSurface, unit_direction};
+2 -1
View File
@@ -5,7 +5,8 @@
//! or third-party ray-tracer implementation is used. See `docs/render-raytrace-core.md`.
use crate::job::CancelToken;
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
mod anisotropic_faces;
pub mod area;
+2 -1
View File
@@ -1,7 +1,8 @@
//! Borrowed prepared-scene contract shared by bounded transport consumers.
use super::{Bvh, Hit, MAX_DISTANCE_MM, Ray, Result, TraceError};
use crate::{ProductScene, surface::OpaqueSurface};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
#[derive(Clone, Copy)]
pub struct PreparedPrimitive {
+2 -1
View File
@@ -1,7 +1,8 @@
//! Original relative point/spot response. Coordinates/reference distances are mm.
//! No lumen, lux, watts, measured CCT, IES or glTF photometry is implied.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use super::{Ray, Result, TraceError, bounded, lighting::MAX_LIGHT_INTENSITY, prepared::SharedHit, unit};
+3 -1
View File
@@ -2,7 +2,8 @@
use super::{Result, TraceError};
use crate::anisotropic_surface::{AnisotropicSurface, VisualFrame};
use crate::surface::{OpaqueSurface, unit_direction};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
#[cfg(test)]
use std::f64::consts::{PI, TAU};
#[derive(Clone, Copy, Debug)]
@@ -133,6 +134,7 @@ mod vndf_tests;
#[cfg(test)]
mod tests {
use super::{OpaqueSurface, PI, Vec3, hash_variates as variates, mirror, rough_specular};
use solidcraft_geom::prelude::*;
fn white() -> OpaqueSurface {
OpaqueSurface::new(Vec3::new(1.0, 1.0, 1.0), 1.0, 1.0, 1.5).unwrap()
}
+2 -1
View File
@@ -4,7 +4,8 @@
use std::sync::Arc;
use solidcraft_geom::{Mesh, Vec3};
use solidcore_record::Vec3;
use solidcraft_geom::Mesh;
use crate::SceneAnalysis;
use crate::hatch::{HATCH_COLOURS, Hatch};
+3 -1
View File
@@ -7,7 +7,9 @@ use crate::{
surface::OpaqueSurface,
};
use serde::{Deserialize, Serialize};
use solidcraft_geom::{Aabb3, Mesh, Vec3};
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use solidcraft_geom::{Aabb3, Mesh};
use std::{collections::BTreeSet, fmt, sync::Arc};
pub const MAX_STAGE_PANELS: usize = 32;
+2 -1
View File
@@ -1,7 +1,8 @@
//! Original fixed direct-light studio used by opaque product preview consumers.
//! Relative linear radiance, not a calibrated illuminance or an HDRI environment.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use crate::surface::{OpaqueSurface, SurfaceError, unit_direction};
+2 -1
View File
@@ -1,9 +1,10 @@
//! Bounded opaque metallic/roughness surfaces in linear sRGB.
//! This numerical contract does not enable a renderer or persist appearances.
use solidcraft_geom::prelude::*;
use std::f64::consts::PI;
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
/// Lowest admitted perceptual roughness. Perfect delta mirrors need another integrator.
pub const MIN_ROUGHNESS: f64 = 0.045;
+2 -1
View File
@@ -1,7 +1,8 @@
//! Original periodic preview fields in an explicit world-space millimetre frame.
//! Only roughness and shading normals change; geometry and visibility do not.
use serde::{Deserialize, Serialize};
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
use std::f64::consts::TAU;
use crate::job::{ErrorCode, JobError, Result};
+2 -1
View File
@@ -1,5 +1,6 @@
//! Bounded optical data and original f64 dielectric transport oracles. Units are mm.
use solidcraft_geom::Vec3;
use solidcore_record::Vec3;
use solidcraft_geom::prelude::*;
#[path = "subsurface.rs"]
pub mod subsurface;
use subsurface::Subsurface;