예제 #1
0
        private static bool IsComponentReal(StrokeComponent comp, List <Vertex> contour, double widthOfPen)
        {
            var stroke = comp.Strokes[0];

            double thresReal     = k1 * widthOfPen;
            double thresSpurious = k2 * widthOfPen;

            if ((double)stroke.Count < thresSpurious)
            {
                return(false);
            }

            if ((double)stroke.Count > thresReal)
            {
                return(true);
            }

            double thresSum = multiplyWidth * widthOfPen * stroke.Count;

            double maxDis = double.MinValue;
            double sum    = 0.0;

            foreach (var vertex in stroke)
            {
                double dis = CalculateDis(vertex, contour);
                maxDis = Math.Max(maxDis, dis);
                sum   += dis;
            }
            if (sum < thresSum && maxDis < widthOfPen)
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        public static void Add(this List <ConnectionNode> connectionNodes, StrokeComponent comp)
        {
            var stroke = comp.Strokes[0];

            connectionNodes.Add(stroke);
        }