Skip to main content

Module dimensions

Module dimensions 

Source
Expand description

Dimension leaders and labels for distance, point-line distance, angle, radius, and diameter constraints.

dim_offsets[cid] = {du, dv} is the plane-space vector from a dimension’s anchor to its label. Leaders and labels share this offset, with per-type defaults when absent. Interaction state overrides the configured constraint color.

Structs§

DimLabel
The label placement + metadata for one dimensional constraint.

Constants§

OVERLAY_DIM_LEADERS
The dimension-leaders overlay group name (its own group so it upserts/clears independently of geometry/points/preview).

Functions§

constraint_dim_segments
The plane-space LEADER segments for ONE dimensional constraint, resolved against doc (None for a non-dimensional / unresolvable constraint). These are the pick + selection-emphasis target for a dimension: the leader lines (extension + dimension line + arrows), NOT the value label — the label is the egui value-edit affordance, so “click the leader” selects and “click the label” edits.
dimension_anchor_uv
The plane (u, v) ANCHOR a dimension’s label offset is measured FROM — the midpoint for a linear distance, the center for a radial dim, the line intersection for an angle. Used by the drag-to-reposition mapping so the stored {du, dv} = (label uv) − (anchor uv). None for a non-dimensional constraint.
dimension_labels
The per-constraint label placements + metadata (one DimLabel per dimensional constraint), with each label anchored in world space.
dimension_leaders_buffers
Build the world-space leader/arrow line segments for every dimensional constraint, as flat (positions, colors) buffers (6 position + 6 color floats per segment) ready to feed the sketch-dim-leaders overlay group.
dimension_leaders_buffers_with_state
Like dimension_leaders_buffers, but emphasizes the hovered / selected dimensional constraint (matched by a {"kind":"constraint","id":…} ref) in the SAME amber / light-blue as a selected / hovered point or geometry; an empty hover
dimension_leaders_overlay_json
The set_overlay JSON for the sketch-dim-leaders group (always emitted, empty when there are no dimensions, so a stale group is cleared).
dimension_leaders_overlay_json_with_state
Like dimension_leaders_overlay_json, but colors the hovered / selected dimensional constraint’s leader distinctly (S: constraint selection).