Skip to main content

Module feature_dimensions

Module feature_dimensions 

Source
Expand description

Feature-dimension annotations (FD-1) — the engine-native port of the original FeatureDimensionAnnotationBuilder.

When a primitive-solid feature is selected and its ◎ is in DIMENSION mode, its key numeric params render as draggable dimension annotations: a leader from world point_apoint_b, editing the param field_key. FD-1 covers the LINEAR builders only (cube / cylinder / cone / sphere / pyramid); the angular + add-material builders (torus arc, revolve/extrude, pattern, port) are FD-2.

Each local-space point convention is copied verbatim from the previous app’s builder so the dims land on the SAME edges it drew — and, because the kernel bakes inputParams.transform with the exact intrinsic XYZ Euler order used here, on the rebuilt solid’s edges too. See the per-builder notes below for the local corner conventions (e.g. the cube’s minimum corner is the origin; the pyramid is centered on its axis with the base at y = -h/2).

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 (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 (a face profile, an unresolved reference — see the builders).
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.