From 7a66e0086525c7b54fc0cbba0b93fb5d94213394 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sat, 28 Nov 2009 18:42:50 -0800 Subject: [PATCH] Stop the perpendicular signs from flickering between the two drawn orientations when u and v are equally good choices. [git-p4: depot-paths = "//depot/solvespace/": change = 2080] --- drawconstraint.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drawconstraint.cpp b/drawconstraint.cpp index a9b6c26..5486a21 100644 --- a/drawconstraint.cpp +++ b/drawconstraint.cpp @@ -655,7 +655,9 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { u = e->VectorGetNum(); u = u.WithMagnitude(16/SS.GW.scale); v = (rn.Cross(u)).WithMagnitude(16/SS.GW.scale); - if(fabs(u.Dot(ru)) < fabs(v.Dot(ru))) { + // a bit of bias to stop it from flickering between the + // two possibilities + if(fabs(u.Dot(ru)) < fabs(v.Dot(ru)) + LENGTH_EPS) { SWAP(Vector, u, v); } if(u.Dot(ru) < 0) u = u.ScaledBy(-1);