Skip to main content

Module feature_dimensions

Module feature_dimensions 

Source
Expand description

Draggable linear and angular annotations for selected feature parameters.

Builders place local-space leaders on the feature’s geometry and apply the same intrinsic XYZ transform as the kernel, keeping annotations aligned with the rebuilt solid. Each annotation identifies the parameter it edits.

Structs§

FeatureDimAnnotation
One editable dimension annotation.
ResolvedRefs
Resolved scene geometry an annotation builder needs beyond the pure inputParams — the profile plane (extrude/revolve) and the axis line (revolve). These are NOT pure params (they resolve scene references), so the engine resolves them from the run report’s sketch profiles / axes, or from the resident scene when the reference names a solid face / edge (see EngineState::feature_dimension_refs), and hands them in. All fields are optional: a builder that can’t source what it needs returns [] gracefully.

Enums§

FeatureDimKind
A dimension annotation’s kind. FD-1 was all FeatureDimKind::Linear; FD-2 adds FeatureDimKind::Angular (torus arc, revolve angle).

Constants§

ANGLE_ARC_RAD_PX
The angle gizmo’s ARC radius, CSS pixels (screen-constant — matching the previous FEATURE_ANGLE_RADIUS_PX). Shared with the engine so the drawn arc, the chip anchor (mid-sweep) and the drag hit-search all use the SAME radius.

Functions§

angular_chip_anchor
The world-space chip anchor for an ANGULAR annotation: the arc mid-sweep point at the screen-constant radius (center + rotate(ref_dir, axis, value/2) * radius) — i.e. labelAnchor = vertex + bisector * radius. Camera-dependent (via world_per_pixel), so the engine computes it per frame.
append_plain_leader
Append a PLAIN leader line a → b (thin silver rod, NO arrowhead cone / origin sphere — nothing that reads as grabbable) onto existing (positions, colors) triangle buffers. The NON-dimensional assembly-constraint overlays (coincident / parallel / …) draw their anchor-to-anchor leaders through this so the line styling stays in this ONE home (same silver + screen-constant radius as the dimension rods, slightly thinner because it carries no handle).
build_annotations
Build the linear dimension annotations for a feature type from its input_params. Dispatches on the primitive-solid type; returns [] for any type without an FD-1 builder (extrude / revolve / booleans / etc.).
build_annotations_with_refs
Build the dimension annotations for a feature, given any resolved scene references (ResolvedRefs) it needs. The primitive-solid + torus builders ignore resolved (pure params + the baked transform); extrude/revolve read the resolved profile plane / axis line and return [] when it is unavailable (an unresolved reference — see the builders). The engine resolves the profile plane from a sketch profile OR a resident solid face.
leaders_buffers
Build the world-space leader geometry for a set of annotations as flat triangle (positions, colors) buffers (9 position + 9 color floats per triangle), ready to feed the feature-dim-leaders overlay group as tris. Normals are omitted — the overlay parser computes a flat face normal per triangle, and the shader’s per-face shade gives the rods/cones/spheres their 3D read. world_per_pixel keeps the rod/cone/sphere screen-constant.
rotate_about_axis
Rotate v by angle radians about unit axis (Rodrigues). Shared with the engine’s angular drag/chip anchoring.