5e0e168ae9
* claim: #8095 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Properties: moment of inertia, principal axes and first moments of a part or assembly (#8095) component.properties and occurrence.properties report each closed body's inertia tensor about its centre of mass, and in total the tensor about the total centre of mass (world axes, g·mm²), its principal moments and axes, the first moments, and with `about: [x, y, z]` the tensor about any point. The tensor comes from each body's welded export mesh, tessellated once per body, scaled to the measured mass and turned by each placement; bodies add by parallel axes. The maths is a new crates/geom inertia module. The Properties window shows the first moments, the tensor, the principal moments and axes, and the view marks the centre of mass with the principal axes while it is open. Inspect → Measure → Properties now opens that window (it ran the command and showed nothing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Properties: Copy matrix, and the whole design's card titled just Properties (#8095) Copy matrix, under the tensor, puts it on the clipboard as three lines of tab-separated values at full precision, in the units shown. The card for the whole design is titled Properties; one opened on a component, placement or bodies keeps its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Properties: measure beside the window, so a large assembly doesn't freeze it (#8095) Properties ran on the window thread: 18 s on a 144-body design, with the window answering nothing meanwhile (#5203). In the desktop app the card now measures on a copy of the session on a worker, the way #4614 made agents' measures work, says "Measuring…" until the reply is in, and Close drops it. A quick measure still shows at once; headless, tests and the web measure in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.0 KiB
Rust
69 lines
2.0 KiB
Rust
//! Geometry foundation for SolidCraft: 2D/3D vectors, sketch planes, axis-aligned boxes,
|
|
//! triangle meshes with their measures (volume, area, centroid), and freeform surface maths
|
|
//! (B-spline basis and NURBS surfaces in [`bspline`], spline spaces and the operators that make
|
|
//! splines compatible in [`spline_space`], one-surface fills of closed loops in [`fill`],
|
|
//! surfaces through curve networks in [`network`], T-splines in [`tspline`]). Units are millimetres.
|
|
//!
|
|
//! This crate has no knowledge of sketches, documents or a modelling backend; every other crate
|
|
//! builds on it.
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
mod aabb2;
|
|
mod arcfit;
|
|
pub mod blend;
|
|
pub mod brep;
|
|
pub mod bspline;
|
|
mod bvh;
|
|
pub mod cell;
|
|
mod chain;
|
|
pub mod compare;
|
|
pub mod drawing_sheet;
|
|
pub mod drawing_view;
|
|
pub mod env;
|
|
pub mod fill;
|
|
pub mod fill_general;
|
|
mod grid;
|
|
pub mod hlr;
|
|
pub mod inertia;
|
|
mod mesh;
|
|
pub mod mesh_distance;
|
|
pub mod network;
|
|
pub mod paper;
|
|
mod plane;
|
|
mod profile;
|
|
pub mod section;
|
|
pub mod simplify;
|
|
pub mod spline_space;
|
|
pub mod srgb;
|
|
pub mod tess;
|
|
pub mod title_block;
|
|
pub mod tspline;
|
|
mod unit_vec3;
|
|
mod vec;
|
|
|
|
pub use aabb2::Aabb2;
|
|
pub use arcfit::MAX_FIT_PIECES;
|
|
pub use blend::hermite_bezier;
|
|
pub use bvh::{Bvh, MeshIndex};
|
|
pub use chain::{Chain, Closed, Ends, Open, Path, Planar, Ring};
|
|
pub use grid::Grid;
|
|
pub use mesh::{Aabb3, BoxedTriangle, InsideIndex, MassProperties, Mesh, MeshMeasure, find_close_pair};
|
|
pub use plane::Plane;
|
|
pub use profile::{Loop2, MAX_BEZIER_CTRL, MAX_BEZIER_DEGREE, MAX_DERIVATIVE_ORDER, Region2, Seg2, Similarity2, bezier, regions_apart};
|
|
pub use unit_vec3::UnitVec3;
|
|
pub use vec::{Vec2, Vec3};
|
|
|
|
/// Geometric tolerance for coincidence tests (mm).
|
|
pub const EPS: f64 = 1e-9;
|
|
/// Linear tolerance used for "same point" decisions in modelling (mm).
|
|
pub const LINEAR_TOL: f64 = 1e-6;
|
|
|
|
/// `x` if finite, else `fallback`.
|
|
pub fn finite_or(x: f64, fallback: f64) -> f64 {
|
|
if x.is_finite() { x } else { fallback }
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|