private bool BoundsMatchSnapLine(Rect bounds, SnapLine snapLine) { if (snapLine.Location == SnapLineLocation.Baseline) { return(true); } Point cornerPoint1; Point cornerPoint2; this.GetTargetCorners(bounds, snapLine.Orientation, snapLine.LocationRelativeToTarget, out cornerPoint1, out cornerPoint2); double signedDistance1 = snapLine.GetSignedDistance(cornerPoint1); double signedDistance2 = snapLine.GetSignedDistance(cornerPoint2); if (Math.Abs(signedDistance1 + snapLine.OffsetRelativeToTarget) < 0.01) { return(Math.Abs(signedDistance2 + snapLine.OffsetRelativeToTarget) < 0.01); } return(false); }
private double CheckForCloserSnapLine(Point p1, SnapLineLocation location, double snapThreshold, List <SnapLine> resultSnapLines, double smallestSignedDistance, SnapLine snapLine, double offset) { double num1 = snapLine.GetSignedDistance(p1) + offset; double num2 = Math.Abs(num1); if (num2 <= snapThreshold) { if (num2 < Math.Abs(smallestSignedDistance)) { smallestSignedDistance = num1; resultSnapLines.Clear(); } if (Math.Abs(num1 - smallestSignedDistance) < 1E-06) { snapLine.LocationRelativeToTarget = location; snapLine.OffsetRelativeToTarget = offset; resultSnapLines.Add(snapLine); } } return(smallestSignedDistance); }