Exemple #1
0
        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)));
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 private double d(StrokeLine a, Point b)
 {
     return(Math.Min(d(a.S, b), d(a.E, b)));
 }