private static void UpdateArrowHeadDirections(LinearDimension dl) { var v = dl.DimensionLineP1 - dl.DimensionLineP2; v.Normalize(); dl.ArrowHead1Direction = v; v.Negate(); dl.ArrowHead2Direction = v; }
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 (IsNan(dl.OffsetPoint) || (dl.OffsetPoint - op).Length > 1e-3) { dl.SetCurrentValue(OffsetPointProperty, dl.P2); dl._hasExplicitOffsetPoint = false; } }
private static Point GetOffsetPoint(Point p, LinearDimension dl) { var op = dl.OffsetPoint + (dl.Scale * dl.Offset * dl.OffsetDirection); var d = Vector.Multiply(op - p, dl.OffsetDirection); return p + (d * dl.OffsetDirection); }
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; } }