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]
This commit is contained in:
Jonathan Westhues 2009-11-28 18:42:50 -08:00
parent b352ca785c
commit 7a66e00865

View File

@ -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);