+ Vector v(position, endpoint);
+ double angle = v.Angle();
+// Vector orthogonal = Vector::Normal(position, endpoint);
+ Vector unit = v.Unit();
+ linePt1 = position, linePt2 = endpoint;
+
+// Horizontally aligned display
+#if 1
+ Vector ortho;
+ double x1, y1, length;
+
+ if (dimensionType == DTLinearVert)
+ {
+ if ((angle < 0) || (angle > PI))
+ // if ((angle < PI_OVER_2) || (angle > PI3_OVER_2))
+ {
+ x1 = (position.x > endpoint.x ? position.x : endpoint.x);
+ y1 = (position.y > endpoint.y ? position.y : endpoint.y);
+ ortho = Vector(1.0, 0);
+ // ortho = Vector(0, 1.0);
+ angle = PI3_OVER_2;
+ // angle = 0;
+ }
+ else
+ {
+ x1 = (position.x > endpoint.x ? endpoint.x : position.x);
+ y1 = (position.y > endpoint.y ? endpoint.y : position.y);
+ ortho = Vector(-1.0, 0);
+ // ortho = Vector(0, -1.0);
+ angle = PI_OVER_2;
+ // angle = PI;
+ }
+
+ linePt1.x = linePt2.x = x1;
+ length = fabs(position.y - endpoint.y);
+ }
+ else if (dimensionType == DTLinearHorz)
+ {
+ if ((angle < PI_OVER_2) || (angle > PI3_OVER_2))
+ {
+ x1 = (position.x > endpoint.x ? position.x : endpoint.x);
+ y1 = (position.y > endpoint.y ? position.y : endpoint.y);
+ ortho = Vector(0, 1.0);
+ angle = 0;
+ }
+ else
+ {
+ x1 = (position.x > endpoint.x ? endpoint.x : position.x);
+ y1 = (position.y > endpoint.y ? endpoint.y : position.y);
+ ortho = Vector(0, -1.0);
+ angle = PI;
+ }
+
+ linePt1.y = linePt2.y = y1;
+ length = fabs(position.x - endpoint.x);
+ }
+ else if (dimensionType == DTLinear)
+ {
+ angle = Vector(linePt1, linePt2).Angle();
+ ortho = Vector::Normal(linePt1, linePt2);
+ length = v.Magnitude();
+ }