Nothing on the load path checked a sketch's size, and every sketch in the timeline is solved when a design opens. The solver sizes its dense matrices by the connected component, so a 30 MB file with 200,000 chained points asked the allocator for terabytes and the process aborted, which no panic guard can intercept. Reject an oversized sketch while the design is still raw JSON, so the typed arrays are never built, and refuse a connected component with more variables than fits in a bounded matrix: that component now reports a failed solve and leaves its geometry alone. 10,000 chained points went from 9.6 GB and 25 seconds to a failed solve in well under a second. Fixes #145 Co-Authored-By: Claude Opus 5 <[email protected]> (cherry picked from commit 04abbf95c26f68c7d0a126ed9e2827049f593361)
48 lines
2.0 KiB
Rust
48 lines
2.0 KiB
Rust
//! Sketches: points and curves on a plane, geometric constraints and driving dimensions, a
|
||
//! Levenberg–Marquardt constraint solver with degree-of-freedom analysis, and closed-profile
|
||
//! (region) detection for features.
|
||
//!
|
||
//! The solver is our own clean-room implementation (residual functions per constraint, local
|
||
//! finite-difference Jacobians, damped Gauss–Newton per connected component, rank analysis by
|
||
//! Gaussian elimination). See `plan/architecture.md` §sketch.
|
||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||
#![forbid(unsafe_code)]
|
||
|
||
mod curves;
|
||
mod dims;
|
||
mod freeform_offset;
|
||
mod linalg;
|
||
mod link;
|
||
mod model;
|
||
mod offset;
|
||
mod offset_topology;
|
||
mod periodic;
|
||
mod profiles;
|
||
mod shape;
|
||
mod solver;
|
||
mod text;
|
||
mod wire;
|
||
|
||
pub use curves::{
|
||
MAX_SPLINE_POINTS, bspline_beziers, conic_point, ellipse_point, end_curvature, fit_beziers, fit_beziers_mode, spline_end_tangent,
|
||
spline_end_tangent_mode, spline_point, spline_point_mode, spline_polyline, spline_polyline_mode,
|
||
};
|
||
pub use dims::{DimFrame, DimLayout, chain_centres, default_text, dim_frame, dim_layout, encode_text};
|
||
pub use freeform_offset::{FreeformOffset, OFFSET_TOLERANCE};
|
||
pub use link::{Link, LinkGeom, LinkKind, LinkSource, MAX_LINK_ENTITIES};
|
||
pub use model::{Constraint, ConstraintKind, Curve, CurveKind, MAX_CONSTRAINTS, MAX_CURVES, MAX_POINTS, SPoint, Sketch, SketchError, SketchView};
|
||
pub use offset::OffsetChain;
|
||
pub use offset_topology::{OffsetCreated, OffsetRole, OffsetRoleFlags, OffsetRoleKind, OffsetTopology};
|
||
pub use periodic::periodic_beziers;
|
||
pub use profiles::{CurvePick, Profile, distinct_curves, find_drawn_profiles, find_profiles, merge_regions, profile_at_point, profile_by_curves};
|
||
pub use shape::{Shape, intersections};
|
||
pub use solver::{Hold, SolveReport, SolveStatus, measure_dimension, solve, solve_holding};
|
||
pub use text::{MAX_TEXT_CHARS, text_geometry};
|
||
pub use wire::{MAX_FIT_POINTS, MAX_WIRE_POINTS, Wire, WireSpace, fit_polyline};
|
||
|
||
#[cfg(test)]
|
||
mod tests;
|
||
|
||
#[cfg(test)]
|
||
mod virtual_corner_tests;
|