Mate connectors: draw the dashed pair line between the two origins

The last unbuilt element of snaporca-wgsc. Two connectors a mate binds are one
object with a gap still in it; drawn as two separate frames they read as
unrelated, and "which two of these five frames are the mate?" had no answer on
screen at all.

Dashed, grey, drawn IN WORLD along the segment joining the origins -- so it
foreshortens with the model and its length is the gap the mate has left to
close. A Fastened mate therefore draws nothing, which is correct: the gap is
zero. Screen-constant dash pitch (6 px dash, 4 px gap) like every other gizmo
here, with the pitch opening up beyond 400 dashes so a mate across a large
assembly cannot emit thousands of segments. Depth test off: the line's job is
to say "these two belong together", and it has to say it even when a part sits
between the camera and one end.

Fed from BOTH sources of polarity truth, the same two the role colours already
use: every committed Mate feature (connectors named by feature index), and the
live pick of an open Mate card (named by combo ordinal). Only resolved frames
are eligible, so an unresolved end draws no line rather than a line to the
origin of the world.

RIG-VERIFIED on :10 with the fresh binary (/OrcaSlicer/build/src/Release,
2026-08-17 12:43): two imported bodies, a face-and-direction connector on each,
Planar mate offset 40. Sampling the segment between the two origins gives a
regular dash/gap alternation of 13:10 sample units -- the 6:4 px pitch -- in the
stroke grey (107,117,133), over both solids. The grey end keeps its open collar
head and the blue end its filled one, so polarity and pair now read together.

Refs snaporca-wgsc
This commit is contained in:
Tommaso Bianchi
2026-08-17 14:48:05 +02:00
parent b4d6abc57a
commit 6fc3c99e31
5 changed files with 61 additions and 1 deletions
+6 -1
View File
@@ -337,7 +337,11 @@ public:
bool roll_undefined{false};
};
void set_mate_connectors(std::vector<MateConnectorGlyph> g) { m_mate_connectors = std::move(g); }
void clear_mate_connectors() { m_mate_connectors.clear(); }
// The pair line: the two origins of every mate — committed ones, plus the live pick of an open
// Mate card. Two connectors a mate binds are ONE object with a gap still in it; drawn as two
// separate frames they read as unrelated.
void set_mate_links(std::vector<std::pair<Vec3d, Vec3d>> l) { m_mate_links = std::move(l); }
void clear_mate_connectors() { m_mate_connectors.clear(); m_mate_links.clear(); }
// Visual Revolve gizmo. The panel feeds the sketch plane + profile centroid + axis (0=plane X,
// 1=plane Y) + angle + flip while its Revolve card is open; an angle-arc is drawn in the
@@ -1085,6 +1089,7 @@ private:
void render_mate_face(const Vec3d& origin, const Vec3d& X, const Vec3d& Y, const Vec3d& Z,
double R, const ColorRGBA& body);
std::vector<MateConnectorGlyph> m_mate_connectors;
std::vector<std::pair<Vec3d, Vec3d>> m_mate_links;
GLModel m_mc_stroke_model;
GLModel m_mc_fill_model; // the face treatment's shaded facets
GLModel m_solid_face_model;