예제 #1
0
        private static void UpdateArrowHeadDirections(LinearDimension dl)
        {
            var v = dl.DimensionLineP1 - dl.DimensionLineP2;

            v.Normalize();
            dl.ArrowHead1Direction = v;
            v.Negate();
            dl.ArrowHead2Direction = v;
        }
예제 #2
0
        private static Point GetOffsetPoint(Point p, LinearDimension dl)
        {
            var op = dl.OffsetPoint + (dl.Scale * dl.Offset * dl.OffsetDirection);

            if (op != null)
            {
                var d = Vector.Multiply(op.Value - p, dl.OffsetDirection);
                return(p + (d * dl.OffsetDirection));
            }

            return(p);
        }
예제 #3
0
        private static void InitializeOffsetVector(LinearDimension dl)
        {
            var v = dl.P1 - dl.P2;

            v.Normalize();
            var dir = Vector.Multiply(v, Rotate90Cw.Value);

            if (!dl.OffsetDirection.Equals(dir))
            {
                dl.SetCurrentValue(OffsetDirectionProperty, dir);
                dl.hasExplicitOffsetDirection = false;
            }
        }
예제 #4
0
        private static void InitializeOffsetPoint(LinearDimension dl)
        {
            var   d  = Vector.Multiply(dl.P1 - dl.P2, dl.OffsetDirection);
            Point op = d < 0
                ? dl.P2
                : dl.P1;

            if (dl.OffsetPoint == null)
            {
                return;
            }

            var offsetPoint = dl.OffsetPoint.Value;

            if (IsNan(offsetPoint) || (offsetPoint - op).Length > 1e-3)
            {
                dl.SetCurrentValue(OffsetPointProperty, dl.P2);
                dl.hasExplicitOffsetPoint = false;
            }
        }