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; } }
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; } }