private double strokeDistance(StrokeLine a, List <StrokeLine> component) { var s = component.First().S; var e = component.Last().E; return(Math.Min(d(a.E, s), d(e, a.S))); }
private bool tryAddComponent(List <StrokeLine> currentStrokeComponent, StrokeLine strokeLine, ShapeNode node, double offset) { var s = currentStrokeComponent.First().S; var e = currentStrokeComponent.Last().E; if (d(strokeLine.E, s) <= d(e, strokeLine.S)) { if (getStrokes(strokeLine.E, s, node, offset - Tolerance, false).Count() != 1) { return(false); } currentStrokeComponent.Insert(0, strokeLine); } else { if (getStrokes(e, strokeLine.S, node, offset - Tolerance, false).Count() != 1) { return(false); } currentStrokeComponent.Add(strokeLine); } return(true); }
private int strokeDistanceComparer(StrokeLine a, StrokeLine b, List <StrokeLine> currentStrokeComponent) { var aDistance = strokeDistance(a, currentStrokeComponent); var bDistance = strokeDistance(b, currentStrokeComponent); if (aDistance == bDistance) { return(0); } return(aDistance > bDistance ? 1 : -1); }
private double d(StrokeLine a, Point b) { return(Math.Min(d(a.S, b), d(a.E, b))); }