Example #1
0
        public List <SubStrokeDescriptor> GetSubStrokes(double charWidth, double charHeight)
        {
            if (!this.isAnalyzed)
            {
                this.AnalyzeAndMark();
            }

            List <SubStrokeDescriptor> subStrokes = new List <SubStrokeDescriptor>();

            // Any WrittenStroke should have at least two points, (a single point cannot constitute a Stroke).
            // We should therefore be safe calling an iterator without checking for the first point.
            WrittenPoint previousPoint = pointList[0];

            for (int i = 1; i != pointList.Count; ++i)
            {
                WrittenPoint nextPoint = pointList[i];

                if (nextPoint.IsPivot)
                {
                    // The direction from each previous point to each successive point, in radians.
                    double direction = previousPoint.GetDirection(nextPoint);

                    // Use the normalized length, to account for relative character size.
                    double normalizedLength = previousPoint.GetDistanceNormalized(nextPoint, charWidth, charHeight);

                    SubStrokeDescriptor subStroke = new SubStrokeDescriptor(direction, normalizedLength);
                    subStrokes.Add(subStroke);

                    previousPoint = nextPoint;
                }
            }

            return(subStrokes);
        }
Example #2
0
        public List<SubStrokeDescriptor> GetSubStrokes(double charWidth, double charHeight)
        {
            if(!this.isAnalyzed) this.AnalyzeAndMark();

            List<SubStrokeDescriptor> subStrokes = new List<SubStrokeDescriptor>();

            // Any WrittenStroke should have at least two points, (a single point cannot constitute a Stroke).
            // We should therefore be safe calling an iterator without checking for the first point.
            WrittenPoint previousPoint = pointList[0];

            for (int i = 1; i != pointList.Count; ++i)
            {
                WrittenPoint nextPoint = pointList[i];

                if(nextPoint.IsPivot)
                {
                    // The direction from each previous point to each successive point, in radians.
                    double direction = previousPoint.GetDirection(nextPoint);

                    // Use the normalized length, to account for relative character size.
                    double normalizedLength = previousPoint.GetDistanceNormalized(nextPoint, charWidth, charHeight);

                    SubStrokeDescriptor subStroke = new SubStrokeDescriptor(direction, normalizedLength);
                    subStrokes.Add(subStroke);

                    previousPoint = nextPoint;
                }
            }

            return subStrokes;
        }