Skip to main content

Module sketch

Module sketch 

Source
Expand description

Engine-native sketch mode — S0 (data model + solver plumbing + read-only display). See docs/developer/sketch-mode-rust-plan.md.

This module is the foundation the interactive slices (S1 enter/exit, S2 picking, S3 tools, S4 constraints, S5 dimensions) build on. S0 provides:

  • docSketchDoc, the typed serde mirror of the solver’s {points, geometries, constraints} (+ SketchDiagnostics).
  • solve — a direct in-process call to the kernel’s 2D constraint solver (brep_kernel::solve_sketch) for solved coordinates + DOF/mobility.
  • tessellate — a port of the previous sketcher’s overlay-refresh pass: solved geometry → world-space overlay lines/points colored by mobility.
  • sessionSketchSession, the {doc, plane, diagnostics} holder (with stubs for the interaction state later slices own).

The engine displays a session read-only via crate::engine_state::EngineState::set_sketch_overlay.

Re-exports§

pub use doc::SketchConstraint;
pub use doc::SketchDiagnostics;
pub use doc::SketchDoc;
pub use doc::SketchGeometry;
pub use doc::SketchPoint;
pub use external_ref::classify_uv;
pub use external_ref::ExternalRef;
pub use session::constraint_ref;
pub use session::entity_ref_eq;
pub use session::geometry_ref;
pub use session::point_ref;
pub use session::refs_equal;
pub use session::SketchSession;
pub use solve::SketchSolverSettings;
pub use tessellate::SketchTessellation;

Modules§

constraint_glyphs
Geometric-constraint glyphs (S6c) — small, screen-constant line-art marks drawn on the sketch overlay next to the geometry a NON-dimensional constraint acts on.
dimensions
Dimension leaders + labels (S5) — a port of the previous sketcher’s dimension rendering.
doc
SketchDoc — the engine-native mirror of the 2D solver’s sketch JSON.
external_ref
External-reference edges (S6b-2) — link a picked 3D solid edge into the sketch as a construction reference.
handdraw
Freehand (handdraw) recognition (S6b-3) — turn a raw hand-drawn stroke into a clean sketch primitive.
infer
Drop-time constraint inference (S6c) — the previous sketcher’s coincident-on-drop / point-on-line-on-drop pair.
session
SketchSession — the in-flight editing/display state for one sketch.
solve
Solve wiring — call the kernel’s 2D constraint solver in-process.
tessellate
Overlay tessellation — a port of the previous sketcher’s overlay refresh.
trim
Sketch trim tool (S6b) — a faithful port of the previous sketcher’s trim-geometry family.

Structs§

PlaneFrame
An orthonormal placement frame for a sketch plane — origin + in-plane x/y axes + the z normal, all in world space (f64). A plane (u, v) coordinate maps to world origin + u·x + v·y (via to_world).

Functions§

ray_plane_uv
Intersect a world-space ray (origin + dir) with a sketch plane and return the hit’s in-plane (u, v) coordinate, or None when the ray is parallel to the plane (|dir·n| < 1e-9) or the hit is behind the ray origin (t <= 0).