From 80dd0fc02988c12e99ada72cbea83071d751b25c Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Tue, 22 Apr 2008 23:46:24 -0800 Subject: [PATCH] Draw the horizontal/vertical markers in the direction of the actual basis vectors, not in the direction of the line connecting the points. [git-p4: depot-paths = "//depot/solvespace/": change = 1684] --- drawconstraint.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drawconstraint.cpp b/drawconstraint.cpp index e86702d..83d5061 100644 --- a/drawconstraint.cpp +++ b/drawconstraint.cpp @@ -146,13 +146,19 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { } else { Vector a = SS.GetEntity(ptA)->PointGetCoords(); Vector b = SS.GetEntity(ptB)->PointGetCoords(); + Entity *csy = SS.GetEntity(SS.GetEntity(ptA)->csys); - Vector cn = csy->Csys2dGetNormalVector(); + Vector cu, cv, cn; + csy->Csys2dGetBasisVectors(&cu, &cv); + cn = csy->Csys2dGetNormalVector(); int i; for(i = 0; i < 2; i++) { Vector o = (i == 0) ? a : b; - Vector d = (i == 0) ? a.Minus(b) : b.Minus(a); + Vector oo = (i == 0) ? a.Minus(b) : b.Minus(a); + Vector d = (type == HORIZONTAL) ? cu : cv; + if(oo.Dot(d) < 0) d = d.ScaledBy(-1); + Vector dp = cn.Cross(d); d = d.WithMagnitude(14/SS.GW.scale); Vector c = o.Minus(d);